FBX: Add additional material properties.
authorMatt Oliver <protogonoi@gmail.com>
Mon, 9 Jan 2017 05:13:25 +0000 (16:13 +1100)
committerMatt Oliver <protogonoi@gmail.com>
Mon, 9 Jan 2017 06:03:38 +0000 (17:03 +1100)
Currently there isnt a AI_MATKEY_DISPLACEMENTSCALING define but fbx supports the value so for the moment it is just manually specified.

code/FBXConverter.cpp

index be7c41f..848da57 100644 (file)
@@ -2134,6 +2134,16 @@ void Converter::SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyT
     if ( ok ) {
         out_mat->AddProperty( &ShininessExponent, 1, AI_MATKEY_SHININESS );
     }
+
+    const float BumpFactor = PropertyGet<float>(props, "BumpFactor", ok);
+    if (ok) {
+        out_mat->AddProperty(&BumpFactor, 1, AI_MATKEY_BUMPSCALING);
+    }
+
+    const float DispFactor = PropertyGet<float>(props, "DisplacementFactor", ok);
+    if (ok) {
+        out_mat->AddProperty(&DispFactor, 1, "$mat.displacementscaling", 0, 0);
+    }
 }