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

Method Update

trinity/Eve/Renderable/Stretch/EveRemotePositionCurve.cpp:28–69  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Value getter for the ITriVectorFunction --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

26// Value getter for the ITriVectorFunction
27// --------------------------------------------------------------------------------
28Vector3* 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:

Callers

nothing calls this directly

Calls 4

TriClampFunction · 0.85
LerpFunction · 0.85
Vector3Class · 0.50
GetValueAtMethod · 0.45

Tested by

no test coverage detected