How to create a mesh with two subsets?
:)
I want to create a mesh with two subsets. I successfully create a mesh with one subset by the function 'D3DXCreateMeshFVF', but how to insert another subset into it?
Subsets are created in a D3DXMesh via setting the attribute buffer up and then calling Optimize().
The attribute buffer is a table of dwords, one for each face, that you can set to whatever you want to group faces together. For example you could put a index to the material used on each face in there.
Once you've filled in the attribute buffer make a call to Optimize() (or OptimizeInPlace()) and it will reorder the VB and IB data as needed to group your mesh into subsets based on the attribute values.
Alternatively you can directly create and set an attribute table (not to be confused with the attribute buffer), but that is a bit more work.
The attribute buffer is a table of dwords, one for each face, that you can set to whatever you want to group faces together. For example you could put a index to the material used on each face in there.
Once you've filled in the attribute buffer make a call to Optimize() (or OptimizeInPlace()) and it will reorder the VB and IB data as needed to group your mesh into subsets based on the attribute values.
Alternatively you can directly create and set an attribute table (not to be confused with the attribute buffer), but that is a bit more work.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement