X-Importer: make it deal with lines.
authorKim Kulling <kim.kulling@googlemail.com>
Fri, 7 Jul 2017 14:34:08 +0000 (16:34 +0200)
committerKim Kulling <kim.kulling@googlemail.com>
Fri, 7 Jul 2017 14:34:08 +0000 (16:34 +0200)
code/XFileImporter.cpp
code/XFileParser.cpp

index f2b1dde..00c32dc 100644 (file)
@@ -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<XFile::Mesh*>& pMeshes)
 {
-    if( pMeshes.size() == 0)
+    if (pMeshes.empty()) {
         return;
+    }
 
     // create a mesh for each mesh-material combination in the source node
     std::vector<aiMesh*> meshes;
index f6030a0..1f8b8cb 100644 (file)
@@ -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();
     }