本文整理汇总了C++中C_BaseAnimating::GetCachedBoneMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ C_BaseAnimating::GetCachedBoneMatrix方法的具体用法?C++ C_BaseAnimating::GetCachedBoneMatrix怎么用?C++ C_BaseAnimating::GetCachedBoneMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_BaseAnimating
的用法示例。
在下文中一共展示了C_BaseAnimating::GetCachedBoneMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildTransformations
virtual void BuildTransformations( CStudioHdr *hdr, Vector *pos, Quaternion q[], const matrix3x4_t& cameraTransform, int boneMask, CBoneBitList &boneComputed )
{
VPROF_BUDGET( "C_ServerRagdollAttached::SetupBones", VPROF_BUDGETGROUP_CLIENT_ANIMATION );
if ( !hdr )
return;
float frac = RemapVal( gpGlobals->curtime, m_parentTime, m_parentTime+ATTACH_INTERP_TIME, 0, 1 );
frac = clamp( frac, 0.f, 1.f );
// interpolate offset over some time
Vector offset = m_vecOffset * (1-frac);
C_BaseAnimating *parent = assert_cast< C_BaseAnimating* >( GetMoveParent() );
Vector worldOrigin;
worldOrigin.Init();
if ( parent )
{
Assert( parent != this );
parent->SetupBones( NULL, -1, BONE_USED_BY_ANYTHING, gpGlobals->curtime );
matrix3x4_t boneToWorld;
parent->GetCachedBoneMatrix( m_boneIndexAttached, boneToWorld );
VectorTransform( m_attachmentPointBoneSpace, boneToWorld, worldOrigin );
}
BaseClass::BuildTransformations( hdr, pos, q, cameraTransform, boneMask, boneComputed );
if ( parent )
{
int index = m_boneIndex[m_ragdollAttachedObjectIndex];
const matrix3x4_t &matrix = GetBone( index );
Vector ragOrigin;
VectorTransform( m_attachmentPointRagdollSpace, matrix, ragOrigin );
offset = worldOrigin - ragOrigin;
// fixes culling
SetAbsOrigin( worldOrigin );
m_vecOffset = offset;
}
for ( int i = 0; i < hdr->numbones(); i++ )
{
if ( !( hdr->boneFlags( i ) & boneMask ) )
continue;
Vector pos;
matrix3x4_t &matrix = GetBoneForWrite( i );
MatrixGetColumn( matrix, 3, pos );
pos += offset;
MatrixSetColumn( pos, 3, matrix );
}
}