Ver Fonte

Fixed a bug in the encoder where point lights were converted to ambient lights when they had no decay

Darryl Gough há 13 anos atrás
pai
commit
4095311da5
1 ficheiros alterados com 10 adições e 3 exclusões
  1. 10 3
      gameplay-encoder/src/FBXSceneEncoder.cpp

+ 10 - 3
gameplay-encoder/src/FBXSceneEncoder.cpp

@@ -767,9 +767,16 @@ void FBXSceneEncoder::loadLight(FbxNode* fbxNode, Node* node)
         switch (decayType)
         switch (decayType)
         {
         {
         case FbxLight::eNone:
         case FbxLight::eNone:
-            // No decay. Can assume we have an ambient light, because ambient lights in the scene are 
-            // converted to point lights with no decay when exporting to FBX.
-            light->setAmbientLight();
+            // FBX does not support ambients lights so ambient lights are converted 
+            // to point lights with no decay and visibility set to false.
+            if (fbxNode->GetVisibility())
+            {
+                light->setPointLight();
+            }
+            else
+            {
+                light->setAmbientLight();
+            }
             break;
             break;
         case FbxLight::eLinear:
         case FbxLight::eLinear:
             light->setPointLight();
             light->setPointLight();