From 70c3823eb75420ab8efde238e207099259319bc5 Mon Sep 17 00:00:00 2001 From: Par Winzell Date: Thu, 21 Feb 2019 12:45:02 -0800 Subject: [PATCH] Fix 'spot' light export. --- src/fbx/Fbx2Raw.cpp | 4 ++-- src/gltf/properties/LightData.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/fbx/Fbx2Raw.cpp b/src/fbx/Fbx2Raw.cpp index 3b31cc7..189828e 100644 --- a/src/fbx/Fbx2Raw.cpp +++ b/src/fbx/Fbx2Raw.cpp @@ -479,8 +479,8 @@ static void ReadLight(RawModel& raw, FbxScene* pScene, FbxNode* pNode) { RAW_LIGHT_TYPE_SPOT, color, intensity, - (float)pLight->InnerAngle.Get(), - (float)pLight->OuterAngle.Get()); + (float)pLight->InnerAngle.Get() * M_PI / 180, + (float)pLight->OuterAngle.Get() * M_PI / 180); break; } default: { diff --git a/src/gltf/properties/LightData.cpp b/src/gltf/properties/LightData.cpp index d090f9e..34bdd40 100644 --- a/src/gltf/properties/LightData.cpp +++ b/src/gltf/properties/LightData.cpp @@ -34,6 +34,14 @@ json LightData::serialize() const { break; case Spot: result["type"] = "spot"; + json spotJson; + if (innerConeAngle != 0) { + spotJson["innerConeAngle"] = innerConeAngle; + } + if (outerConeAngle != M_PI_4) { + spotJson["outerConeAngle"] = outerConeAngle; + } + result["spot"] = spotJson; break; } return result;