mesh optimize!optimize!
My game demo is not use the ID3DXMesh interface. So I can not call Optimize and OptimizeInplace method and I must optimizing mesh by myself.
But, I don''t know what''s the so-called Attibute Tables?? My demo''s mesh is convert from the .3ds file. These only have some vertices and indices data.
How get the Attribute Tables and how to use the tables? The important is : how to use the Attributes Tables?
The attribute table is an array of dword values, which sets the subset it belongs to for each face (triangle).
So you can fill it with just 0x00000000, in that case a call to drawsubset(0) will just draw the entire mesh. Usually you would set attributes for each texture, If you have a 10-triangle mesh and the first 5 triangles use texture x and the other 5 would use texture y, then your attribute buffer would be (0,0,0,0,0,1,1,1,1,1).
Then you draw it with
dev->settexture(x)
mesh->drawsubset(0)
dev->settexture(y)
mesh->drawsubset(1)
But why not load your data into a ID3DXMesh ? you just need to create it with the number of triangles and vertexes, and then fill a vertex buffer, index buffer and attribute buffer and you''re done. Then you can use all the mesh functions.
So you can fill it with just 0x00000000, in that case a call to drawsubset(0) will just draw the entire mesh. Usually you would set attributes for each texture, If you have a 10-triangle mesh and the first 5 triangles use texture x and the other 5 would use texture y, then your attribute buffer would be (0,0,0,0,0,1,1,1,1,1).
Then you draw it with
dev->settexture(x)
mesh->drawsubset(0)
dev->settexture(y)
mesh->drawsubset(1)
But why not load your data into a ID3DXMesh ? you just need to create it with the number of triangles and vertexes, and then fill a vertex buffer, index buffer and attribute buffer and you''re done. Then you can use all the mesh functions.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement