From 4ddacdb5df027759267f452a2f365d5385805fc2 Mon Sep 17 00:00:00 2001 From: Terence Russell Date: Tue, 22 Feb 2022 17:55:41 -0700 Subject: [PATCH] Expose the original OBJ illum model as a material property. --- code/AssetLib/Obj/ObjFileImporter.cpp | 3 +++ include/assimp/ObjMaterial.h | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/code/AssetLib/Obj/ObjFileImporter.cpp b/code/AssetLib/Obj/ObjFileImporter.cpp index 6dd26956e..68fdb2172 100644 --- a/code/AssetLib/Obj/ObjFileImporter.cpp +++ b/code/AssetLib/Obj/ObjFileImporter.cpp @@ -605,6 +605,9 @@ void ObjFileImporter::createMaterials(const ObjFile::Model *pModel, aiScene *pSc mat->AddProperty(&sm, 1, AI_MATKEY_SHADING_MODEL); + // Preserve the original illum value + mat->AddProperty(&pCurrentMaterial->illumination_model, 1, AI_MATKEY_OBJ_ILLUM); + // Adding material colors mat->AddProperty(&pCurrentMaterial->ambient, 1, AI_MATKEY_COLOR_AMBIENT); mat->AddProperty(&pCurrentMaterial->diffuse, 1, AI_MATKEY_COLOR_DIFFUSE); diff --git a/include/assimp/ObjMaterial.h b/include/assimp/ObjMaterial.h index 39894a696..bba207638 100644 --- a/include/assimp/ObjMaterial.h +++ b/include/assimp/ObjMaterial.h @@ -53,6 +53,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include +// --------------------------------------------------------------------------- + +// the original illum property +#define AI_MATKEY_OBJ_ILLUM "$mat.illum", 0, 0 + +// --------------------------------------------------------------------------- + // --------------------------------------------------------------------------- // Pure key names for all obj texture-related properties //! @cond MATS_DOC_FULL