From 6e1d031ecd8eb184baf3a7be50b39d85bb45d8e4 Mon Sep 17 00:00:00 2001 From: Areloch Date: Tue, 15 Sep 2015 19:56:35 -0500 Subject: [PATCH] Corrects light animation to adhere to the brightness level set in the light's params instead of sticking with the default 0-1 brightness range. --- Engine/source/T3D/lightAnimData.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/lightAnimData.cpp b/Engine/source/T3D/lightAnimData.cpp index 5f6270023..b61d2b47d 100644 --- a/Engine/source/T3D/lightAnimData.cpp +++ b/Engine/source/T3D/lightAnimData.cpp @@ -195,6 +195,7 @@ bool LightAnimData::AnimValue::animate( F32 time, F32 *output ) F32 scaledTime, lerpFactor, valueRange, keyFrameLerp; U32 posFrom, posTo; S32 keyFrameFrom, keyFrameTo; + F32 initialValue = *output; bool wasAnimated = false; @@ -215,13 +216,13 @@ bool LightAnimData::AnimValue::animate( F32 time, F32 *output ) valueRange = ( value2[i] - value1[i] ) / 25.0f; if ( !smooth[i] ) - output[i] = value1[i] + ( keyFrameFrom * valueRange ); + output[i] = (value1[i] + (keyFrameFrom * valueRange)) * initialValue; else { lerpFactor = scaledTime - posFrom; keyFrameLerp = ( keyFrameTo - keyFrameFrom ) * lerpFactor; - output[i] = value1[i] + ( ( keyFrameFrom + keyFrameLerp ) * valueRange ); + output[i] = (value1[i] + ((keyFrameFrom + keyFrameLerp) * valueRange)) * initialValue; } }