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.

This commit is contained in:
Areloch 2015-09-15 19:56:35 -05:00
parent 82bafd9f35
commit 6e1d031ecd

View file

@ -195,6 +195,7 @@ bool LightAnimData::AnimValue<COUNT>::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<COUNT>::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;
}
}