From d0ca41e103ac80230174bd7e4440ad2f883790c2 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Tue, 21 May 2019 01:06:01 -0400 Subject: [PATCH] Prevents engine crash when loading shapes using the KHR_draco_mesh_compression extension. --- Engine/lib/assimp/code/glTF2Asset.h | 5 ++++- Engine/lib/assimp/code/glTF2Asset.inl | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Engine/lib/assimp/code/glTF2Asset.h b/Engine/lib/assimp/code/glTF2Asset.h index 0015197c2..60aba7bc9 100644 --- a/Engine/lib/assimp/code/glTF2Asset.h +++ b/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; diff --git a/Engine/lib/assimp/code/glTF2Asset.inl b/Engine/lib/assimp/code/glTF2Asset.inl index b12a92f3a..616044356 100644 --- a/Engine/lib/assimp/code/glTF2Asset.inl +++ b/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 }