瀏覽代碼

Merge pull request #4409 from TerenceRussell/master

Expose the original OBJ "illum" value
Kim Kulling 3 年之前
父節點
當前提交
04858c5d89
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 3 0
      code/AssetLib/Obj/ObjFileImporter.cpp
  2. 7 0
      include/assimp/ObjMaterial.h

+ 3 - 0
code/AssetLib/Obj/ObjFileImporter.cpp

@@ -605,6 +605,9 @@ void ObjFileImporter::createMaterials(const ObjFile::Model *pModel, aiScene *pSc
 
         mat->AddProperty<int>(&sm, 1, AI_MATKEY_SHADING_MODEL);
 
+        // Preserve the original illum value
+        mat->AddProperty<int>(&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);

+ 7 - 0
include/assimp/ObjMaterial.h

@@ -53,6 +53,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include <assimp/material.h>
 
+// ---------------------------------------------------------------------------
+
+// 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