From af216ec29486e534983a80b9509cfbf787659c25 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 7 Jul 2017 16:34:08 +0200 Subject: [PATCH] X-Importer: make it deal with lines. --- code/XFileImporter.cpp | 3 ++- code/XFileParser.cpp | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/code/XFileImporter.cpp b/code/XFileImporter.cpp index f2b1dde7e..00c32dcc2 100644 --- a/code/XFileImporter.cpp +++ b/code/XFileImporter.cpp @@ -237,8 +237,9 @@ aiNode* XFileImporter::CreateNodes( aiScene* pScene, aiNode* pParent, const XFil // Creates the meshes for the given node. void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vector& pMeshes) { - if( pMeshes.size() == 0) + if (pMeshes.empty()) { return; + } // create a mesh for each mesh-material combination in the source node std::vector meshes; diff --git a/code/XFileParser.cpp b/code/XFileParser.cpp index f6030a0e0..1f8b8cbd3 100644 --- a/code/XFileParser.cpp +++ b/code/XFileParser.cpp @@ -466,15 +466,12 @@ void XFileParser::ParseDataObjectMesh( Mesh* pMesh) pMesh->mPosFaces.resize( numPosFaces); for( unsigned int a = 0; a < numPosFaces; a++) { - unsigned int numIndices = ReadInt(); - if( numIndices < 3) { - ThrowException( format() << "Invalid index count " << numIndices << " for face " << a << "." ); - } - // read indices + unsigned int numIndices = ReadInt(); Face& face = pMesh->mPosFaces[a]; - for( unsigned int b = 0; b < numIndices; b++) - face.mIndices.push_back( ReadInt()); + for (unsigned int b = 0; b < numIndices; b++) { + face.mIndices.push_back( ReadInt() ); + } TestForSeparator(); }