-------------------------------------------------------------------------------- Description: Value getter for the ITriVectorFunction --------------------------------------------------------------------------------
| 26 | // Value getter for the ITriVectorFunction |
| 27 | // -------------------------------------------------------------------------------- |
| 28 | Vector3* EveRemotePositionCurve::Update( Vector3* in, Be::Time t ) |
| 29 | { |
| 30 | // not do anything if no start point |
| 31 | if( !m_startPositionCurve ) |
| 32 | { |
| 33 | *in = Vector3( 0.f, 0.f, 0.f ); |
| 34 | return in; |
| 35 | } |
| 36 | |
| 37 | // timing |
| 38 | if( m_startTime == 0 ) |
| 39 | { |
| 40 | m_startTime = t; |
| 41 | } |
| 42 | float timeSinceStart = TimeAsFloat( t - m_startTime ); |
| 43 | |
| 44 | float s = 0.f; |
| 45 | |
| 46 | // delay sweep if set! |
| 47 | if( timeSinceStart > m_delayTime ) |
| 48 | { |
| 49 | // loop or not to loop! |
| 50 | if( m_cycle ) |
| 51 | { |
| 52 | s = TriClamp( fmod( ( timeSinceStart - m_delayTime ), m_sweepTime ) / m_sweepTime, 0.f, 1.f ); |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | s = TriClamp( ( timeSinceStart - m_delayTime ) / m_sweepTime, 0.f, 1.f ); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | // interpolate current offset |
| 61 | Vector3 currentOffsetDir = Lerp( m_offsetDir1, m_offsetDir2, s ); |
| 62 | |
| 63 | // add to start position |
| 64 | Vector3 startPos; |
| 65 | m_startPositionCurve->GetValueAt( &startPos, t ); |
| 66 | *in = m_value = startPos + currentOffsetDir; |
| 67 | |
| 68 | return in; |
| 69 | } |
| 70 | |
| 71 | // -------------------------------------------------------------------------------- |
| 72 | // Description: |
nothing calls this directly
no test coverage detected