| 40 | } |
| 41 | |
| 42 | Vector3 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 | |
| 73 | Vector3 Tr2FollowCurve::GetSegmentValue( float time, ITr2FollowCurveKey& k0, ITr2FollowCurveKey& k1 ) const |
| 74 | { |
no test coverage detected