This topic is now archived and is closed to further replies.


Code for a Mesh Class

Recommended Posts

I am coding a mesh class but I need something that is flexible. The mesh class will handle static (non-animated) meshes, frame (like MD2) meshes and hard and soft skinned meshes. I will split the model into many parts for the rendering because different textures are used, different shaders are used, there are not enough shader addresses to hold the whole bone skeleton, and I want to change the parts (i.e. various heads can be used, etc). I was wondering what would be the most efficient method. Should I use a seperate vertex and index buffer for each part, should I combine all the vertex buffers and just use different index buffers or should I combine it all and render parts of the index buffer each time. For x number of parts in a mesh, there would be at least 2x number of parts all together.

Share this post

Link to post
Share on other sites
What if you just wrote a function that created and loaded
a Direct3DMesh from your file data. Something with
a interface like

IDirect3DXMesh* LoadMesh(const char* fileName);

Just read in your mesh info, create a directx mesh,
and stuff it with the data from your file.

This way, you can leave the rendering to directx, all you
have to worry about is that the vertex and index buffers are
loaded correctly.

Share this post

Link to post
Share on other sites