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

Method getTime

Engine/source/T3D/cameraSpline.cpp:274–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272
273
274F32 CameraSpline::getTime(F32 d)
275{
276 if (mSize <= 1)
277 return 0;
278
279 // Find nodes spanning the distance
280 Vector<TimeMap>::iterator end = mTimeMap.begin() + 1, start;
281 for (; end < (mTimeMap.end() - 1) && end->mDistance < d; end++) { }
282 start = end - 1;
283
284 // Check for duplicate points..
285 F32 seg = end->mDistance - start->mDistance;
286 if (!seg)
287 return end->mTime;
288
289 // Interpolate between the two nodes
290 F32 i = (d - start->mDistance) / (end->mDistance - start->mDistance);
291 return start->mTime + (end->mTime - start->mTime) * i;
292}
293
294
295//-----------------------------------------------------------------------------

Callers 3

advanceTimeMethod · 0.45
updatePosMethod · 0.45
_moveMethod · 0.45

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected