Browse Source

Obj loader ignores empty meshes now. Thanks for tomva for the patch (see http://sourceforge.net/projects/assimp/forums/forum/817654/topic/3402881).

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@487 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
aramis_acg 16 years ago
parent
commit
8b19981ce9
1 changed files with 4 additions and 2 deletions
  1. 4 2
      code/ObjFileImporter.cpp

+ 4 - 2
code/ObjFileImporter.cpp

@@ -188,8 +188,10 @@ aiNode *ObjFileImporter::createNodes(const ObjFile::Model* pModel, const ObjFile
 	for (unsigned int meshIndex = 0; meshIndex < pModel->m_Meshes.size(); meshIndex++)
 	{
 		pMesh = new aiMesh();
-		MeshArray.push_back( pMesh );
 		createTopology( pModel, pData, meshIndex, pMesh );	
+		if (pMesh->mNumVertices > 0) {
+			MeshArray.push_back( pMesh );
+		}
 	}
 
 	// Create all nodes from the subobjects stored in the current object
@@ -299,7 +301,7 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
 
 	// Get current mesh
 	ObjFile::Mesh *pObjMesh = pModel->m_Meshes[ uiMeshIndex ];
-	if ( NULL == pObjMesh )
+	if ( NULL == pObjMesh || pObjMesh->m_uiNumIndices < 1)
 		return;
 
 	// Copy vertices of this mesh instance