Sign in to follow this  
giugio

[directx 9]Mesh

Recommended Posts

giugio    246
Hy. I'm created an importer for collada file. The importer import all the meshes from collada file in a unique big mesh with a subset for any collada mesh. the problem is that with a very large file 10Mb i have a mesh with 100000 vertex and 31000 indexes and this catch an error: D3DX: D3DXCreateMesh: Too many faces/vertices for a 16bit mesh [quote] bool CImporter::CreateMesh(int nVertexes, int nIndexes) { HRESULT hr = D3DXCreateMeshFVF(nIndexes,nVertexes,D3DXMESH_MANAGED,Vertex::FVF,m_Device,&m_mesh); if(FAILED(hr)) { ::MessageBox(0, "Collada CreateMesh() - FAILED", 0, 0); return false; } return true; } [quote] may be Is a wrong method? Is better to create a mesh for mesh in collada file and use a vector for store all the meshes of the file? whath is the best container for meshes in directx? THanks.

Share this post


Link to post
Share on other sites
giugio    246
Hy.
I have modify the importer for return single more simple divided meshes:
Quote:

vector<ID3DXMesh*>m_AllMeshes;
CImporter cin = CImporter(Device,IMPORTER_COLLADA);
cin.Init("c:\\ferrari.dae");
//cin.GetColladaMesh(Mesh,0);

for ( int k = 0 ;k <cin.GetAllMeshesCount();k++){
cin.GetColladaMesh(Mesh,k);
m_AllMeshes.push_back(Mesh);
}


where
cin.GetColladaMesh(Mesh,k);
get the mesh in pos k from all the meshes of collada file.
and draw all:
Quote:

Device->BeginScene();

std::vector<ID3DXMesh*>::iterator itMesh;
for(itMesh = m_AllMeshes.begin();itMesh != m_AllMeshes.end();itMesh++)
{
Device->SetMaterial(&mtrl);
ID3DXMesh* xmesh= *itMesh;
xmesh->DrawSubset(0);
}
//for(int i = 0; i < NumSubsets; i++)
//{
// Device->SetMaterial(&mtrl);
// //Device->SetTexture( 0, Textures[i] );
// Mesh->DrawSubset(0);
//}

Device->EndScene();


but the result is no good , not all meshes are drawed!
only some.

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