Sign in to follow this  
chisoft

How to create a mesh with two subsets?

Recommended Posts

chisoft    122
:) 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?

Share this post


Link to post
Share on other sites
reltham    642
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.

Share this post


Link to post
Share on other sites

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