Sign in to follow this  

Creating subsets programmatically

This topic is 4863 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[i].AttribId = i; pattTable[i].FaceCount = attFaceCount ; pattTable[i].FaceStart = attFaceStart ; pattTable[i].VertexCount = attVertexCount ; pattTable[i].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
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

This topic is 4863 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this