MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / animate

Method animate

Engine/source/T3D/lightAnimData.cpp:194–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192
193template<U32 COUNT>
194bool LightAnimData::AnimValue<COUNT>::animate(F32 time, F32 *output, bool multiply)
195{
196 F32 scaledTime, lerpFactor, valueRange, keyFrameLerp;
197 U32 posFrom, posTo;
198 S32 keyFrameFrom, keyFrameTo;
199 F32 initialValue = *output;
200 if (!multiply)
201 initialValue = 1;
202
203 bool wasAnimated = false;
204
205 for ( U32 i=0; i < COUNT; i++ )
206 {
207 if ( mIsZero( timeScale[i] ) )
208 continue;
209
210 wasAnimated = true;
211
212 scaledTime = mFmod( time, period[i] ) * timeScale[i];
213
214 posFrom = mFloor( scaledTime );
215 posTo = mCeil( scaledTime );
216
217 keyFrameFrom = dToupper( keys[i][posFrom] ) - 65;
218 keyFrameTo = dToupper( keys[i][posTo] ) - 65;
219 valueRange = ( value2[i] - value1[i] ) / 25.0f;
220
221 if ( !smooth[i] )
222 output[i] = (value1[i] + (keyFrameFrom * valueRange)) * initialValue;
223 else
224 {
225 lerpFactor = scaledTime - posFrom;
226 keyFrameLerp = ( keyFrameTo - keyFrameFrom ) * lerpFactor;
227
228 output[i] = (value1[i] + ((keyFrameFrom + keyFrameLerp) * valueRange)) * initialValue;
229 }
230 }
231
232 return wasAnimated;
233}
234
235template<U32 COUNT>
236void LightAnimData::AnimValue<COUNT>::write( BitStream *stream ) const

Callers 15

updateDamageStateMethod · 0.45
_prepRenderImageMethod · 0.45
prepBatchRenderMethod · 0.45
renderMountedImageMethod · 0.45
castRayMethod · 0.45
castRayRenderedMethod · 0.45
buildPolyListMethod · 0.45
getPolyListMethod · 0.45
renderWorldMethod · 0.45
prepBatchRenderMethod · 0.45
prepRenderImageMethod · 0.45
castRayMethod · 0.45

Calls 12

mIsZeroFunction · 0.85
mFmodFunction · 0.85
mFloorFunction · 0.85
mCeilFunction · 0.85
dToupperFunction · 0.85
mDegToRadFunction · 0.85
displaceMethod · 0.80
setBrightnessMethod · 0.80
getCurrentTimeFunction · 0.50
mulMethod · 0.45
setTransformMethod · 0.45
setColorMethod · 0.45

Tested by

no test coverage detected