MCPcopy Create free account
hub / github.com/carbonengine/trinity / GetValue

Method GetValue

trinity/Curves/Tr2FollowCurve.cpp:42–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42Vector3 Tr2FollowCurve::GetValue( double time ) const
43{
44 ITr2FollowCurveKey* currentKey = nullptr;
45 ITr2FollowCurveKey* nextKey = nullptr;
46 Vector3 value = Vector3();
47 for( auto key = begin( m_keys ); key != end( m_keys ); ++key )
48 {
49 auto k = *key;
50
51 if( time < k->GetTime() )
52 {
53 nextKey = k;
54 break;
55 }
56 currentKey = k;
57 }
58
59 if( nextKey && currentKey )
60 {
61 value = GetSegmentValue( float( time ), *currentKey, *nextKey );
62 }
63 else if( currentKey )
64 {
65 value = currentKey->GetValue();
66 }
67
68 currentKey = nullptr;
69 nextKey = nullptr;
70 return value;
71}
72
73Vector3 Tr2FollowCurve::GetSegmentValue( float time, ITr2FollowCurveKey& k0, ITr2FollowCurveKey& k1 ) const
74{

Callers 1

GetSegmentValueMethod · 0.45

Calls 4

Vector3Class · 0.50
beginFunction · 0.50
endFunction · 0.50
GetTimeMethod · 0.45

Tested by

no test coverage detected