Browse Source

Restore import of multi mesh binary STLs

Regression introduced in: 9a9f18bbed8938323548335d9225e480a0ea8ca6

This restores the behaviour for binary STLs with multiple bodies.

The code could be improved (to reuse code found at the end of LoadASCIIFile) but for now this is a quick fix
Daniel Hritzkiv 7 years ago
parent
commit
67c236647d
1 changed files with 6 additions and 0 deletions
  1. 6 0
      code/STLLoader.cpp

+ 6 - 0
code/STLLoader.cpp

@@ -505,6 +505,12 @@ bool STLImporter::LoadBinaryFile()
     // now copy faces
     addFacesToMesh(pMesh);
 
+    // add all created meshes to the single node
+    pScene->mRootNode->mNumMeshes = pScene->mNumMeshes;
+    pScene->mRootNode->mMeshes = new unsigned int[pScene->mNumMeshes];
+    for (unsigned int i = 0; i < pScene->mNumMeshes; i++)
+        pScene->mRootNode->mMeshes[i] = i;
+
     if (bIsMaterialise && !pMesh->mColors[0])
     {
         // use the color as diffuse material color