From 8b19981ce9bbb8ca34dc7613a4ae25d9f7d9ec45 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Tue, 29 Sep 2009 11:01:20 +0000 Subject: [PATCH] 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 --- code/ObjFileImporter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/ObjFileImporter.cpp b/code/ObjFileImporter.cpp index 0f5f6dac4..d86fbaade 100644 --- a/code/ObjFileImporter.cpp +++ b/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