VertexData is empty

Jo0oker

25-05-2010 21:20:54

Hello Community,
i have a short question,

i tried to count my verticies by getting the VertexData:

VertexData myVertexData = this.Entity.GetMesh().sharedVertexData;

But "myVertexData" is every time empty.

Does some one know the problem?

P.S.: The mesh is loading correctly.

Greats,
Jo0oker

smiley80

26-05-2010 01:09:23

You have to iterate through the submeshes and get their vertexdata.
If you have a Mesh which sharedVertexData is not null, you'll have to check whether a SubMesh has the useSharedVertices property set to true.

for (ushort i = 0; i < mesh.NumSubMeshes; i++)
{
SubMesh submesh = mesh.GetSubMesh(i);
VertexData vd;
if (submesh.useSharedVertices)
{
vd = mesh.sharedVertexData;
}
else
{
vd = subMesh.vertexData;
}

// Do stuff
}

Jo0oker

27-05-2010 13:19:45

Thank you, it works great!

Greats,
Jo0oker