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

Method LerpToFirstKey

trinity/Curves/Tr2CurveVector3Lerp.cpp:46–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46Vector3 Tr2CurveVector3Lerp::LerpToFirstKey( double time ) const
47{
48 Vector3 curveStartValue;
49 m_curve->GetValueAt( &curveStartValue, 0.0 );
50
51 if( m_curveStartTime <= 0.0 )
52 {
53 return curveStartValue;
54 }
55 else if( m_startInterpolation == Tr2CurveVector3LerpKeyInterpolation::LINEAR )
56 {
57 return Lerp( m_initialValue, curveStartValue, (float)time / m_curveStartTime );
58 }
59 else
60 {
61 Vector3 prev = m_initialValue;
62 Vector3 next = curveStartValue;
63
64 float s = (float)time / m_curveStartTime;
65
66 float c2 = -2.0f * s * s * s + 3.0f * s * s;
67 float c1 = 1.0f - c2;
68
69 // Hermite with 0 tangents
70 return prev * c1 + next * c2;
71 }
72
73 return Vector3( 0, 0, 0 );
74}
75
76Vector3* Tr2CurveVector3Lerp::Update( Vector3* in, Be::Time time )
77{

Callers

nothing calls this directly

Calls 3

LerpFunction · 0.85
Vector3Class · 0.50
GetValueAtMethod · 0.45

Tested by

no test coverage detected