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

Method Interpolate

trinity/Curves/Tr2BoneMatrixCurve.cpp:123–152  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Description: Supposedly interpolates between two keys. This function doesn't actually do that, though. If there is no skinned object or bone, it returns the identity matrix. If there is a skinned object, this multiplies the bone transform for the cached joint by the skinned object's world transform. Arguments:

Source from the content-addressed store, hash-verified

121// The matrix result of the 'interpolation'
122// --------------------------------------------------------------------------------------
123Matrix* Tr2BoneMatrixCurve::Interpolate( Matrix* out, Tr2MatrixKey* /*startKey*/, Tr2MatrixKey* /*endKey*/ )
124{
125 if( !m_skinnedObject || m_bone.empty() )
126 {
127 *out = XMMatrixIdentity();
128 return out;
129 }
130
131 if( m_skeletonTag != m_skinnedObject->GetSkeletonTag() )
132 {
133 m_cachedJoint = m_skinnedObject->GetBoneIndex( m_bone );
134 if( m_cachedJoint != ~0u )
135 {
136 m_skeletonTag = m_skinnedObject->GetSkeletonTag();
137 }
138 }
139
140 const Matrix* m = m_skinnedObject->GetBoneTransform( m_cachedJoint );
141 if( m )
142 {
143 // We've got the bone in local space, now we need to multiply it
144 // by our skinned object's world transform.
145 *out = XMMatrixMultiply( XMMatrixMultiply( m_transform, *m ), m_skinnedObject->GetTransform() );
146 }
147 else
148 {
149 *out = XMMatrixIdentity();
150 }
151 return out;
152}

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.80
GetSkeletonTagMethod · 0.80
GetBoneTransformMethod · 0.80
GetBoneIndexMethod · 0.45
GetTransformMethod · 0.45

Tested by

no test coverage detected