From bc4e4112848c007122b7ad4d523705a35051c18e Mon Sep 17 00:00:00 2001 From: b1skit Date: Sat, 27 Apr 2019 17:20:27 -0700 Subject: [PATCH] Updated the FBXConverter to correctly set the material shading mode when a Phong shader is detected --- code/FBXConverter.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index 0abfdafdc..c76d3ccad 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -67,6 +67,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include + + + + // MY DEBUG STUFF: + +#include +using std::cout; + +// END MY DEBUG STUF + + + + namespace Assimp { namespace FBX { @@ -1596,6 +1609,13 @@ namespace Assimp { out_mat->AddProperty(&str, AI_MATKEY_NAME); } + // Set the shading mode as best we can: The FBX specification only mentions Lambert and Phong, and only Phong is mentioned in Assimp's aiShadingMode enum. + if (material.GetShadingModel() == "phong") + { + aiShadingMode shadingMode = aiShadingMode_Phong; + out_mat->AddProperty(&shadingMode, 1, AI_MATKEY_SHADING_MODEL); + } + // shading stuff and colors SetShadingPropertiesCommon(out_mat, props); SetShadingPropertiesRaw( out_mat, props, material.Textures(), mesh );