Vetices from Mesh in DirectX
Hello,
I have learnt through tutorials how to make meshes from vertices. But now I wana know how to get vertices and the position of vertices from a mesh. The mesh is created by loading a DirectX file. It is a 3D model.
Thank you,
Best Wishes,
Ahmed H.
You get the structure of the vertex data using mesh->GetFVF or mesh->GetDeclaration. Those calls will tell how the vertex structure is arranged and the offset in bytes to each element of the vertex.
You can then use mesh->LockVertexBuffer to get a pointer to the vertices.
Given the vertex buffer pointer, say BYTE *vb:
You can then use mesh->LockVertexBuffer to get a pointer to the vertices.
Given the vertex buffer pointer, say BYTE *vb:
for(WORD v=0; v < numVertices; v++){ D3DXVECTOR3 pos = *((D3DXVECTOR3*)(vb + v*numBytesPerVertex + offset_to_what_you_want));}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement