Im not familiar with PhysX 2.x code - so I cant help you here.
You could remove the TriMeshDesc.flags = NX_MF_16_BIT_INDICES; line - maybe this is the problem.
(And change to TriMeshDesc.triangleStrideBytes = 3*sizeof(int);)
This flag wont work for int indices - (32bit) and I guess your model have int indices.
But I´m not sure about it. But I had a similiar issue. For optimizing reasons I´ve tested
it with the flag - and with a test level. But I forgot to change it back - with a larger mesh
and it wont cooked the mesh (well:)).
I dont know if you are receiving the right model information about
indices, vertex count - you should google for it.
Here is the way how I feed the meshDesc with information.
Maybe it help you. (PhysX 3.2.4 Code!)
meshDesc.points.count = data.mVertexCount;
meshDesc.points.stride = sizeof(Vector3);
meshDesc.points.data = data.mVertices;
meshDesc.triangles.stride = 3*sizeof(int);
meshDesc.triangles.data = data.mIndices;
meshDesc.triangles.count = data.mIndexCount / 3;
Hm I dont like this piece of code:
int NumTriangles = Model->GetNumFaces();
Is it possible that you use quads instead of triangles?
And directx count it wrong here?
Is there maybe a function like GetNumIndices()?
I dont know the specs about the DirectX .x mesh format (there are different versions of it)
but maybe the .x mesh format save partially polygons instead of triangles.
Faces could also be quads or even polygons - so maybe the error is in this code (or in the mesh file).
(Triangle count != face count)?
The best way I think is to get the index count and divide it by 3.
The PhysX cooker want to cook triangles of the information - if they are wrong or incompleted, you
get strange results like yours.