This topic is 2858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I get a bunch of vertex data from a file and wish to add it to a LPD3DXMESH.

 LPD3DXMESH pMesh; 

 LPDIRECT3DVERTEXBUFFER9 pVertexBuffer; 

I guess the LPD3DXMESH has a member LPDIRECT3DVERTEXBUFFER9, and calling pMesh->LockVertexBuffer would be the same as calling pVertexBuffer->Lock, as it is a wrapper.

But I only know how to copy over a bunch of vertex data, I don't quite know how that is devided up into SubSets. I guess it could be some indexing attributes, but I dont think such data is available.

Here is the deal, the file I load has a block of vertex data, then some DDS images and then another block of vertex data. I could just put each block in their own vertex buffers and wrap around them, but I would much rather just stick with the one ID3DXMesh and have the blocks organized as subsets (as they are probably intended to do).

So, after some hours googling I have not yet found how I can make subsets in a blank LPD3DXMESH and copy vertex data into each subset, can you help?

##### Share on other sites
You can use ID3DXBaseMesh::GetAttributeTable to get an array of D3DXATTRIBUTERANGEs which describe the offsets into the index and vertex buffer for each subset. To write subset informations to the mesh, use ID3DXMesh::SetAttributeTable.

Ps: I'd suggest avoiding ID3DXMESH completely and write your own mesh class...

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 21
• 23
• 11
• 25