# DirectX: meshes assembled into model VS ID3DX10Mesh

No replies to this topic

### #1Xcrypt

New Member

• Members
• 144 posts
• LocationBelgium

Posted 02 May 2012 - 09:51 PM

Hi, currently I'm looking into supporting 3D models for my graphics engine.

This is how the core parts of my graphics engine work atm:

class Geometry: consists of a vertexbuffer and an indexbuffer (optional)
class Mesh: consists of the data for a single mesh to be drawn: geometry, material, etc
class Renderer: sorts Meshes according to material and does some additional optimising for execution speed, also renders the actual meshes.

Now, I was planning to create a model class, which could hold several meshes, so 3d models could be drawn with multiple geometries all having their own material.
However, I recently came across something called ID3DX10Mesh. Apparently ID3DX10Mesh has the option to do this:

// Reorder the vertices according to subset and optimize the mesh for this graphics
// card's vertex cache. When rendering the mesh's triangle list the vertices will
// cache hit more often so it won't have to re-execute the vertex shader.
HR( m_pID3DX10Mesh ->GenerateAdjacencyAndPointReps( 1e-6f ) );
HR( m_pID3DX10Mesh ->Optimize( D3DX10_MESHOPT_ATTR_SORT | D3DX10_MESHOPT_VERTEX_CACHE, NULL, NULL ) );
They also allow different materials for one ID3DX10Mesh

I'm wondering if I should go through with my original idea, or use these ID3DX10Meshes. I do have the problem however that using those ID3DX10Meshes might mess up my renderer quite a bit.

What is generally done for good performance regarding this matter?