• Advertisement
Sign in to follow this  

Finding the number of meshes in lib3DS...

This topic is 4926 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I use this code for getting the number of meshes: int NumMeshes(Lib3dsFile *f){ Lib3dsMesh *mesh=NULL; Lib3dsMesh *pmesh=NULL; int num_meshes=0; mesh=f->meshes; do{ num_meshes++; pmesh=mesh; mesh=f->meshes->next; }while(strcmp(pmesh->name,mesh->name)); return num_meshes; } Unfortunately it is'nt correct as it gets 2 meshes if I have 10 of them in 3DS. Maybe I am supposed to get the number by counting nodes, but how? All suggestions are welcome, thank You..

Share this post


Link to post
Share on other sites
Advertisement
You should be able to do it like this.

int NumMeshes(Lib3dsFile *f)
{
Lib3dsNode* index;
int num_meshes=0;


for(index=f->nodes;index!=NULL;index=index->next)
{
num_meshes++;
}
return num_meshes;
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement