Jump to content
  • Advertisement
Sign in to follow this  
j_h

Creating subsets programmatically

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have succesfully created a mesh, but now I want to create subsets in the mesh. I have tried using the ID3DXMesh->SetAttributeTable() but this call refuses to create any subsets. Instead I get the following D3DX-error message for every face I try to assign to a subset other than 0: "D3DX: ID3DXMesh::SetAttributeTable: AttributeID of face 2 does not match the attribute range 1 that it is assigned to" My code looks like this: D3DXATTRIBUTERANGE pattTable[6] ; DWORD attFaceStart = 0 ; DWORD attFaceCount = 2 ; DWORD attVertexStart = 0 ; DWORD attVertexCount = 4 ; for (unsigned int i = 0; i < 6; i++) { pattTable.AttribId = i; pattTable.FaceCount = attFaceCount ; pattTable.FaceStart = attFaceStart ; pattTable.VertexCount = attVertexCount ; pattTable.VertexStart = attVertexStart ; attFaceStart+=2; attVertexStart+=4; } // set attributetable pnewMesh->SetAttributeTable(pattTable,6); Does this problem sound familiar to anyone? Many thanks! JH

Share this post


Link to post
Share on other sites
Advertisement
You need to set the Attribute ID of each face using the AttributeBuffer calls on the mesh (Lock, fill in, Unlock).

Then you call Optimize() or OptimizeInPlace() to create the attribute table for you (which will define all the subsets).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!