Explorar el Código

Do not create GLTF Mesh if no faces (#5878)

Previously GLTF meshes were created even if there were no faces, which lead to GLTFs which were not technically valid.

I believe this fixes the problem I was encountering, but I've not been able to test it because of some Mac compile errors. Will test on a windows machine at some point.

Fixes #5868

Co-authored-by: Kim Kulling <[email protected]>
Julian Knodt hace 10 meses
padre
commit
ca17cdc1f9
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      code/AssetLib/glTF2/glTF2Exporter.cpp

+ 4 - 0
code/AssetLib/glTF2/glTF2Exporter.cpp

@@ -61,6 +61,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <cinttypes>
 #include <limits>
 #include <memory>
+#include <iostream>
 
 using namespace rapidjson;
 
@@ -1177,6 +1178,9 @@ void glTF2Exporter::ExportMeshes() {
 
     for (unsigned int idx_mesh = 0; idx_mesh < mScene->mNumMeshes; ++idx_mesh) {
         const aiMesh *aim = mScene->mMeshes[idx_mesh];
+        if (aim->mNumFaces == 0) {
+            continue;
+        }
 
         std::string name = aim->mName.C_Str();