Преглед изворни кода

Merge pull request #1555 from assimp/issue_1315

closes https://github.com/assimp/assimp/issues/1315: check in exporti…
Kim Kulling пре 7 година
родитељ
комит
bd104bda3b
1 измењених фајлова са 4 додато и 3 уклоњено
  1. 4 3
      code/ObjExporter.cpp

+ 4 - 3
code/ObjExporter.cpp

@@ -258,7 +258,6 @@ void ObjExporter::WriteMaterialFile()
     }
 }
 
-// ------------------------------------------------------------------------------------------------
 void ObjExporter::WriteGeometryFile(bool noMtl) {
     WriteHeader(mOutput);
     if (!noMtl)
@@ -280,8 +279,10 @@ void ObjExporter::WriteGeometryFile(bool noMtl) {
         mOutput << "# " << vp.size() << " vertex positions and colors" << endl;
         size_t colIdx = 0;
         for ( const aiVector3D& v : vp ) {
-            mOutput << "v  " << v.x << " " << v.y << " " << v.z << " " << vc[ colIdx ].r << " " << vc[ colIdx ].g << " " << vc[ colIdx ].b << endl;
-            colIdx++;
+            if ( colIdx < vc.size() ) {
+                mOutput << "v  " << v.x << " " << v.y << " " << v.z << " " << vc[ colIdx ].r << " " << vc[ colIdx ].g << " " << vc[ colIdx ].b << endl;
+            }
+            ++colIdx;
         }
     }
     mOutput << endl;