From 7b54b0f40623b7c5e3a657f03dfe1fa06926ed79 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 21 Dec 2023 20:54:49 +0100 Subject: [PATCH 01/12] Fix leak - closes https://github.com/assimp/assimp/issues/5390 --- code/AssetLib/Irr/IRRLoader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/AssetLib/Irr/IRRLoader.cpp b/code/AssetLib/Irr/IRRLoader.cpp index 99e053892..2a481a6d8 100644 --- a/code/AssetLib/Irr/IRRLoader.cpp +++ b/code/AssetLib/Irr/IRRLoader.cpp @@ -1234,7 +1234,10 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy // Parse the XML // Find the scene root from document root. const pugi::xml_node &sceneRoot = documentRoot.child("irr_scene"); - if (!sceneRoot) throw new DeadlyImportError("IRR: not found in file"); + if (!sceneRoot) { + delete root; + throw new DeadlyImportError("IRR: not found in file"); + } for (pugi::xml_node &child : sceneRoot.children()) { // XML elements are either nodes, animators, attributes, or materials if (!ASSIMP_stricmp(child.name(), "node")) { From 274f64cbf1942328b74d22dcc246d568670a8b68 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 22 Dec 2023 09:45:37 +0100 Subject: [PATCH 02/12] Check validity of archive without parsing - closes https://github.com/assimp/assimp/issues/5392 --- code/AssetLib/3MF/D3MFImporter.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/code/AssetLib/3MF/D3MFImporter.cpp b/code/AssetLib/3MF/D3MFImporter.cpp index e8529064c..2633bacf4 100644 --- a/code/AssetLib/3MF/D3MFImporter.cpp +++ b/code/AssetLib/3MF/D3MFImporter.cpp @@ -81,12 +81,17 @@ static constexpr aiImporterDesc desc = { "3mf" }; -bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool /*checkSig*/) const { +bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool ) const { if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) { return false; } - D3MF::D3MFOpcPackage opcPackage(pIOHandler, filename); - return opcPackage.validate(); + + ZipArchiveIOSystem archive(pIOHandler, rFile); + if (!mZipArchive->archive()) { + return false; + } + + return true; } void D3MFImporter::SetupProperties(const Importer*) { From b9576e6992ba2ec7b3468d6f51a53d2258ccdc0f Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 22 Dec 2023 10:32:54 +0100 Subject: [PATCH 03/12] Update D3MFImporter.cpp --- code/AssetLib/3MF/D3MFImporter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/3MF/D3MFImporter.cpp b/code/AssetLib/3MF/D3MFImporter.cpp index 2633bacf4..5508c2505 100644 --- a/code/AssetLib/3MF/D3MFImporter.cpp +++ b/code/AssetLib/3MF/D3MFImporter.cpp @@ -85,9 +85,9 @@ bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bo if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) { return false; } - + static const char *const ModelRef = "3D/3dmodel.model"; ZipArchiveIOSystem archive(pIOHandler, rFile); - if (!mZipArchive->archive()) { + if (!archive.Exists(ModelRef)) { return false; } From 9dddef9b9dff03f341a7a22b0e8d5178f8b1f2d3 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 22 Dec 2023 10:37:34 +0100 Subject: [PATCH 04/12] Update D3MFImporter.cpp --- code/AssetLib/3MF/D3MFImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/3MF/D3MFImporter.cpp b/code/AssetLib/3MF/D3MFImporter.cpp index 5508c2505..9a5081db9 100644 --- a/code/AssetLib/3MF/D3MFImporter.cpp +++ b/code/AssetLib/3MF/D3MFImporter.cpp @@ -86,7 +86,7 @@ bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bo return false; } static const char *const ModelRef = "3D/3dmodel.model"; - ZipArchiveIOSystem archive(pIOHandler, rFile); + ZipArchiveIOSystem archive(pIOHandler, filename); if (!archive.Exists(ModelRef)) { return false; } From 69dae9599a4bf7c7ce50a6ed672ef3d017cb1f90 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 22 Dec 2023 11:57:43 +0100 Subject: [PATCH 05/12] Fix integer overflow - closes https://github.com/assimp/assimp/issues/4930 --- code/AssetLib/MDL/MDLMaterialLoader.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/AssetLib/MDL/MDLMaterialLoader.cpp b/code/AssetLib/MDL/MDLMaterialLoader.cpp index 3d39fa645..57ed6c7b9 100644 --- a/code/AssetLib/MDL/MDLMaterialLoader.cpp +++ b/code/AssetLib/MDL/MDLMaterialLoader.cpp @@ -123,9 +123,8 @@ aiColor4D MDLImporter::ReplaceTextureWithColor(const aiTexture *pcTexture) { // Read a texture from a MDL3 file void MDLImporter::CreateTextureARGB8_3DGS_MDL3(const unsigned char *szData) { const MDL::Header *pcHeader = (const MDL::Header *)mBuffer; //the endianness is already corrected in the InternReadFile_3DGS_MDL345 function - - VALIDATE_FILE_SIZE(szData + pcHeader->skinwidth * - pcHeader->skinheight); + const size_t len = pcHeader->skinwidth * pcHeader->skinheight); + VALIDATE_FILE_SIZE(szData + len); // allocate a new texture object aiTexture *pcNew = new aiTexture(); From 5d5496f1ad895297cede723b3c96b513263f82ed Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 22 Dec 2023 13:06:10 +0100 Subject: [PATCH 06/12] Update MDLMaterialLoader.cpp --- code/AssetLib/MDL/MDLMaterialLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/MDL/MDLMaterialLoader.cpp b/code/AssetLib/MDL/MDLMaterialLoader.cpp index 57ed6c7b9..f8dafdb3e 100644 --- a/code/AssetLib/MDL/MDLMaterialLoader.cpp +++ b/code/AssetLib/MDL/MDLMaterialLoader.cpp @@ -123,7 +123,7 @@ aiColor4D MDLImporter::ReplaceTextureWithColor(const aiTexture *pcTexture) { // Read a texture from a MDL3 file void MDLImporter::CreateTextureARGB8_3DGS_MDL3(const unsigned char *szData) { const MDL::Header *pcHeader = (const MDL::Header *)mBuffer; //the endianness is already corrected in the InternReadFile_3DGS_MDL345 function - const size_t len = pcHeader->skinwidth * pcHeader->skinheight); + const size_t len = pcHeader->skinwidth * pcHeader->skinheight; VALIDATE_FILE_SIZE(szData + len); // allocate a new texture object From 263bebb5baace5d7869aa348015257279ebfc5e9 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 29 Dec 2023 16:30:42 +0100 Subject: [PATCH 07/12] Add a test before generating the txture folder --- code/Pbrt/PbrtExporter.cpp | 18 +++-- test/CMakeLists.txt | 1 + .../ImportExport/Pbrt/utPbrtImportExport.cpp | 70 +++++++++++++++++++ 3 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 test/unit/ImportExport/Pbrt/utPbrtImportExport.cpp diff --git a/code/Pbrt/PbrtExporter.cpp b/code/Pbrt/PbrtExporter.cpp index 67937019f..6191b6ba1 100644 --- a/code/Pbrt/PbrtExporter.cpp +++ b/code/Pbrt/PbrtExporter.cpp @@ -97,13 +97,23 @@ void ExportScenePbrt ( ){ std::string path = DefaultIOSystem::absolutePath(std::string(pFile)); std::string file = DefaultIOSystem::completeBaseName(std::string(pFile)); - + path = path + file + ".brt"; // initialize the exporter PbrtExporter exporter(pScene, pIOSystem, path, file); } } // end of namespace Assimp +static void create_embedded_textures_folder(const aiScene *scene, IOSystem *pIOSystem) { + if (scene->mNumTextures > 0) { + if (!pIOSystem->Exists("textures")) { + if (!pIOSystem->CreateDirectory("textures")) { + throw DeadlyExportError("Could not create textures/ directory."); + } + } + } +} + // Constructor PbrtExporter::PbrtExporter( const aiScene *pScene, IOSystem *pIOSystem, @@ -127,10 +137,10 @@ PbrtExporter::PbrtExporter( 0.f, 0.f, 1.f, 0.f, // 0.f, 0.f, 0.f, 1.f // ) * mRootTransform; + // Export embedded textures. - if (mScene->mNumTextures > 0) - if (!mIOSystem->CreateDirectory("textures")) - throw DeadlyExportError("Could not create textures/ directory."); + create_embedded_textures_folder(mScene, mIOSystem); + for (unsigned int i = 0; i < mScene->mNumTextures; ++i) { aiTexture* tex = mScene->mTextures[i]; std::string fn = CleanTextureFilename(tex->mFilename, false); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index afe487411..da6a5b00b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -165,6 +165,7 @@ SET( IMPORTERS unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp unit/ImportExport/RAW/utRAWImportExport.cpp unit/ImportExport/Terragen/utTerragenImportExport.cpp + unit/ImportExport/Pbrt/utPbrtImportExport.cpp ) SET( MATERIAL diff --git a/test/unit/ImportExport/Pbrt/utPbrtImportExport.cpp b/test/unit/ImportExport/Pbrt/utPbrtImportExport.cpp new file mode 100644 index 000000000..c7807205a --- /dev/null +++ b/test/unit/ImportExport/Pbrt/utPbrtImportExport.cpp @@ -0,0 +1,70 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2020, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above +copyright notice, this list of conditions and the +following disclaimer. + +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the +following disclaimer in the documentation and/or other +materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its +contributors may be used to endorse or promote products +derived from this software without specific prior +written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------------------------- +*/ +#include "AbstractImportExportBase.h" +#include "UnitTestPCH.h" +#include +#include +#include +#include + +using namespace Assimp; + +class utPbrtImportExport : public AbstractImportExportBase { +public: +#ifndef ASSIMP_BUILD_NO_EXPORT + bool exporterTest() override { + Assimp::Importer importer; + const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure); + EXPECT_NE(scene, nullptr ); + + ::Assimp::Exporter exporter; + return AI_SUCCESS == exporter.Export(scene, "pbrt", ASSIMP_TEST_MODELS_DIR "/OBJ/spider_out.pbrt"); + } +#endif +}; + +#ifndef ASSIMP_BUILD_NO_EXPORT + +TEST_F(utPbrtImportExport, exportTest_Success) { + EXPECT_TRUE(exporterTest()); +} + +#endif // ASSIMP_BUILD_NO_EXPORT From 636fbd65b3ff1e4f4ae11cec6380b86d07efc682 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 29 Dec 2023 16:47:21 +0100 Subject: [PATCH 08/12] Refactorings: come code cleanups --- code/Pbrt/PbrtExporter.cpp | 14 +++------- code/Pbrt/PbrtExporter.h | 52 +++++++++++++++---------------------- include/assimp/IOSystem.hpp | 10 ++----- 3 files changed, 26 insertions(+), 50 deletions(-) diff --git a/code/Pbrt/PbrtExporter.cpp b/code/Pbrt/PbrtExporter.cpp index 6191b6ba1..9e4ca293d 100644 --- a/code/Pbrt/PbrtExporter.cpp +++ b/code/Pbrt/PbrtExporter.cpp @@ -89,15 +89,11 @@ using namespace Assimp; namespace Assimp { -void ExportScenePbrt ( - const char* pFile, - IOSystem* pIOSystem, - const aiScene* pScene, - const ExportProperties* /*pProperties*/ -){ +void ExportScenePbrt(const char *pFile, IOSystem *pIOSystem, const aiScene *pScene, + const ExportProperties *) { std::string path = DefaultIOSystem::absolutePath(std::string(pFile)); std::string file = DefaultIOSystem::completeBaseName(std::string(pFile)); - path = path + file + ".brt"; + path = path + file + ".pbrt"; // initialize the exporter PbrtExporter exporter(pScene, pIOSystem, path, file); } @@ -114,7 +110,6 @@ static void create_embedded_textures_folder(const aiScene *scene, IOSystem *pIOS } } -// Constructor PbrtExporter::PbrtExporter( const aiScene *pScene, IOSystem *pIOSystem, const std::string &path, const std::string &file) : @@ -186,9 +181,6 @@ PbrtExporter::PbrtExporter( outfile->Write(mOutput.str().c_str(), mOutput.str().length(), 1); } -// Destructor -PbrtExporter::~PbrtExporter() = default; - void PbrtExporter::WriteMetaData() { mOutput << "#############################\n"; mOutput << "# Scene metadata:\n"; diff --git a/code/Pbrt/PbrtExporter.h b/code/Pbrt/PbrtExporter.h index c7e8180e2..a4b1a608a 100644 --- a/code/Pbrt/PbrtExporter.h +++ b/code/Pbrt/PbrtExporter.h @@ -70,15 +70,33 @@ class ExportProperties; // --------------------------------------------------------------------- /** Helper class to export a given scene to a Pbrt file. */ // --------------------------------------------------------------------- -class PbrtExporter -{ +class PbrtExporter { public: /// Constructor for a specific scene to export PbrtExporter(const aiScene *pScene, IOSystem *pIOSystem, const std::string &path, const std::string &file); /// Destructor - virtual ~PbrtExporter(); + virtual ~PbrtExporter() = default; + +private: + aiMatrix4x4 GetNodeTransform(const aiString &name) const; + static std::string TransformAsString(const aiMatrix4x4 &m); + static std::string RemoveSuffix(std::string filename); + std::string CleanTextureFilename(const aiString &f, bool rewriteExtension = true) const; + void WriteMetaData(); + void WriteWorldDefinition(); + void WriteCameras(); + void WriteCamera(int i); + void WriteLights(); + void WriteTextures(); + static bool TextureHasAlphaMask(const std::string &filename); + void WriteMaterials(); + void WriteMaterial(int i); + void WriteMesh(aiMesh *mesh); + void WriteInstanceDefinition(int i); + void WriteGeometricObjects(aiNode *node, aiMatrix4x4 parentTransform, + std::map &meshUses); private: // the scene to export @@ -96,39 +114,11 @@ private: /// Name of the file (without extension) where the scene will be exported const std::string mFile; -private: // A private set to keep track of which textures have been declared std::set mTextureSet; // Transform to apply to the root node and all root objects such as cameras, lights, etc. aiMatrix4x4 mRootTransform; - - aiMatrix4x4 GetNodeTransform(const aiString& name) const; - static std::string TransformAsString(const aiMatrix4x4& m); - - static std::string RemoveSuffix(std::string filename); - std::string CleanTextureFilename(const aiString &f, bool rewriteExtension = true) const; - - void WriteMetaData(); - - void WriteWorldDefinition(); - - void WriteCameras(); - void WriteCamera(int i); - - void WriteLights(); - - void WriteTextures(); - static bool TextureHasAlphaMask(const std::string &filename); - - void WriteMaterials(); - void WriteMaterial(int i); - - void WriteMesh(aiMesh* mesh); - - void WriteInstanceDefinition(int i); - void WriteGeometricObjects(aiNode* node, aiMatrix4x4 parentTransform, - std::map &meshUses); }; } // namespace Assimp diff --git a/include/assimp/IOSystem.hpp b/include/assimp/IOSystem.hpp index 30f48b81c..acb1f8eae 100644 --- a/include/assimp/IOSystem.hpp +++ b/include/assimp/IOSystem.hpp @@ -97,7 +97,7 @@ public: * Create an instance of your derived class and assign it to an * #Assimp::Importer instance by calling Importer::SetIOHandler(). */ - IOSystem() AI_NO_EXCEPT; + IOSystem() AI_NO_EXCEPT = default; // ------------------------------------------------------------------- /** @brief Virtual destructor. @@ -105,7 +105,7 @@ public: * It is safe to be called from within DLL Assimp, we're constructed * on Assimp's heap. */ - virtual ~IOSystem(); + virtual ~IOSystem() = default; // ------------------------------------------------------------------- /** @brief For backward compatibility @@ -236,12 +236,6 @@ private: std::vector m_pathStack; }; -// ---------------------------------------------------------------------------- -AI_FORCE_INLINE IOSystem::IOSystem() AI_NO_EXCEPT = default; - -// ---------------------------------------------------------------------------- -AI_FORCE_INLINE IOSystem::~IOSystem() = default; - // ---------------------------------------------------------------------------- // For compatibility, the interface of some functions taking a std::string was // changed to const char* to avoid crashes between binary incompatible STL From 5cbdb6c63b8229d1a41a99857112cc3811d82076 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 29 Dec 2023 17:31:11 +0100 Subject: [PATCH 09/12] Build: Disable building zlib for non-windows - closes https://github.com/assimp/assimp/issues/5340 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88f69174a..4eca71955 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,7 +137,7 @@ IF (WIN32) ELSE() OPTION( ASSIMP_BUILD_ZLIB "Build your own zlib" - ON + OFF ) ENDIF() From 6bcdf989fb7331aab8fa3b1afe6a0740b1a4ec9b Mon Sep 17 00:00:00 2001 From: copycd Date: Sat, 30 Dec 2023 16:46:08 +0900 Subject: [PATCH 10/12] Triangle value is null-error, I don't know why it happened. --- contrib/poly2tri/poly2tri/sweep/sweep.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/poly2tri/poly2tri/sweep/sweep.cc b/contrib/poly2tri/poly2tri/sweep/sweep.cc index 565a198d8..e1f23f11b 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep.cc +++ b/contrib/poly2tri/poly2tri/sweep/sweep.cc @@ -111,6 +111,9 @@ void Sweep::EdgeEvent(SweepContext& tcx, Edge* edge, Node* node) void Sweep::EdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* triangle, Point& point) { + if (triangle == nullptr) + return; + if (IsEdgeSideOfTriangle(*triangle, ep, eq)) { return; } From ec122eb348ba5da816ba2466f6f4622c51ef4b06 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Dec 2023 19:14:40 +0000 Subject: [PATCH 11/12] Bump actions/upload-artifact from 3 to 4 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ccpp.yml | 2 +- .github/workflows/cifuzz.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 3859c04db..1c533aa80 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -98,7 +98,7 @@ jobs: run: cd build/bin && ./unit ${{ steps.hunter_extra_test_args.outputs.args }} shell: bash - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: matrix.name == 'windows-msvc' with: name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}' diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index a84be8cbc..38f54ce06 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -19,7 +19,7 @@ jobs: dry-run: false language: c++ - name: Upload Crash - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() && steps.build.outcome == 'success' with: name: artifacts From 9776d47ccad48cbd4ea7869e93df9e8e8244615c Mon Sep 17 00:00:00 2001 From: tangxin Date: Fri, 5 Jan 2024 10:02:26 +0800 Subject: [PATCH 12/12] fix: KHR_materials_pbrSpecularGlossiness/diffuseFactor convert to pbrMetallicRoughness/baseColorFactor --- code/AssetLib/glTF2/glTF2Exporter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/AssetLib/glTF2/glTF2Exporter.cpp b/code/AssetLib/glTF2/glTF2Exporter.cpp index 836e15f9f..17d162466 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.cpp +++ b/code/AssetLib/glTF2/glTF2Exporter.cpp @@ -912,6 +912,7 @@ void glTF2Exporter::ExportMaterials() { if (GetMatSpecular(mat, specular)) { mAsset->extensionsUsed.KHR_materials_specular = true; m->materialSpecular = Nullable(specular); + GetMatColor(mat, m->pbrMetallicRoughness.baseColorFactor, AI_MATKEY_COLOR_DIFFUSE); } MaterialSheen sheen;