Selaa lähdekoodia

Prevents engine crash when loading shapes using the KHR_draco_mesh_compression extension.

OTHGMars 6 vuotta sitten
vanhempi
commit
45f631b5e5
2 muutettua tiedostoa jossa 15 lisäystä ja 1 poistoa
  1. 4 1
      Engine/lib/assimp/code/glTF2Asset.h
  2. 11 0
      Engine/lib/assimp/code/glTF2Asset.inl

+ 4 - 1
Engine/lib/assimp/code/glTF2Asset.h

@@ -1,4 +1,4 @@
-/*
+/*
 Open Asset Import Library (assimp)
 ----------------------------------------------------------------------
 
@@ -1047,6 +1047,9 @@ namespace glTF2
         {
             bool KHR_materials_pbrSpecularGlossiness;
             bool KHR_materials_unlit;
+            //T3D_CHANGE_BEGIN
+            bool KHR_draco_mesh_compression;
+            //T3D_CHANGE_END
 
         } extensionsUsed;
 

+ 11 - 0
Engine/lib/assimp/code/glTF2Asset.inl

@@ -1360,6 +1360,14 @@ inline void Asset::Load(const std::string& pFile, bool isBinary)
     // Load the metadata
     asset.Read(doc);
     ReadExtensionsUsed(doc);
+    
+    //T3D_CHANGE_BEGIN
+    if (extensionsUsed.KHR_draco_mesh_compression)
+    {
+       ASSIMP_LOG_ERROR("GLTF: Draco mesh compression is not supported by Torque3D.");
+       throw DeadlyImportError("GLTF: Draco mesh compression is not supported by Torque3D.");
+    }
+    //T3D_CHANGE_END
 
     // Prepare the dictionaries
     for (size_t i = 0; i < mDicts.size(); ++i) {
@@ -1425,6 +1433,9 @@ inline void Asset::ReadExtensionsUsed(Document& doc)
 
     CHECK_EXT(KHR_materials_pbrSpecularGlossiness);
     CHECK_EXT(KHR_materials_unlit);
+    //T3D_CHANGE_BEGIN
+    CHECK_EXT(KHR_draco_mesh_compression);
+    //T3D_CHANGE_END
 
     #undef CHECK_EXT
 }