OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.
With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.
For more information visit the official OpenID site.
45 Posts in 15 Topics by 16 members
Jump to:If this is your first visit, you will need to register before you can post. However, you can browse all messages below.
| Page: 1 | go to end | Reply |
| Author | Topic: Correct way of setting arrays for triangle mesh | 461 views |
31 January 2009 at 12:58pm
Hi.
I've written a parser for .x directx files that will create a NxVec3 array of vertices and a uint32 array size of (x, 3) of indicies.
But the properties only takes pointers, whats the correct way of settings these two properties?
Best Regards, Anders
31 January 2009 at 3:21pm
This is my code, coocked returns false, and it crashes on last line
NxTriangleMesh mesh = sdk.createTriangleMesh(stream);
private NxActor CreateActorFromFile(string filename)
{
MeshManager meshManager = new MeshManager();
NxActor actor = null;
NxVec3[] vertices;
int[,] indices;
meshManager.GetMesh(filename, out vertices, out indices);
// create stream
NxStream stream = new NxStream();
NxTriangleMeshDesc meshDesc = new NxTriangleMeshDesc();
// go unsafe
unsafe
{
// fix pointers
fixed (int* pIndices = indices)
fixed (NxVec3* pVertices = vertices)
{
// assign pointers
meshDesc.triangles = new IntPtr((void*)pIndices);
meshDesc.points = new IntPtr((void*)pVertices);
meshDesc.pointStrideBytes = (uint)sizeof(NxVec3);
meshDesc.numVertices = (uint)vertices.Length;
meshDesc.numTriangles = (uint)indices.Length / 3;
meshDesc.triangleStrideBytes = 3 * sizeof(int);
meshDesc.flags = 0;
meshDesc.heightFieldVerticalAxis = NxHeightFieldAxis.NX_Z;
meshDesc.heightFieldVerticalExtent = -1000.0f;
// create mesh
NxCookingInterface cooking = PhysXLoader.NxGetCookingLib(PhysXLoader.NX_PHYSICS_SDK_VERSION);
bool cooked = cooking.NxCookTriangleMesh(meshDesc, stream);
}
}
NxTriangleMesh mesh = sdk.createTriangleMesh(stream);
return actor;
}
Last edited: 1 February 2009 at 9:21pm
1 February 2009 at 9:38pm
I haven't done much with mesh cooking myself so far, but a few things I can come up with are:
Last edited: 1 February 2009 at 9:39pm
| 461 views | ||
| go to top | Reply |