mesh optimize!optimize!

Started by
2 comments, last by coollofty 20 years, 2 months ago
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?
Advertisement
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.
Thx.
I don''t load my mesh into ID3DXMesh, because I want to know how to draw a 3D model by myself. I hope learn some low-level technique. So, optimize a mesh myself is a compulsory work, it can help me learn more.

(My english is bad, sorry)
No body help me?

This topic is closed to new replies.

Advertisement