本文整理汇总了C++中Animation::CalculateTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ Animation::CalculateTransform方法的具体用法?C++ Animation::CalculateTransform怎么用?C++ Animation::CalculateTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animation
的用法示例。
在下文中一共展示了Animation::CalculateTransform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecursiveProcess
void Skeleton::RecursiveProcess(float time, Bone& bone, Animation& anim, MatrixBuffer& buffer, TrackBuffer& trackData, XMFLOAT4X4 parentTransform)
{
VQS vqs;
anim.CalculateTransform(time, bone.BoneIndex, vqs, trackData[bone.BoneIndex]);
XMFLOAT4X4 localTransform = vqs.GetMatrix();
XMFLOAT4X4 modelTransform; // = localTransform * parentTransform;
XMStoreFloat4x4(&modelTransform, XMMatrixMultiply(XMLoadFloat4x4(&localTransform), XMLoadFloat4x4(&parentTransform)));
buffer[bone.BoneIndex] = modelTransform;
for (UINT i = 0; i < bone.Children.size(); ++i)
{
RecursiveProcess(time, *bone.Children[i], anim, buffer, trackData, modelTransform);
}
}
示例2: ProcessAnimationGraph
void Skeleton::ProcessAnimationGraph(float time, MatrixBuffer& buffer, Animation& anim, TrackBuffer& trackData)
{
//Linear Form This only works because the bone parent is always guaranteed to be in front
//of its children (breath first order)
XMFLOAT4X4 identity;
XMStoreFloat4x4(&identity, XMMatrixIdentity());
for (UINT boneIndex = 0; boneIndex < m_Bones.size(); ++boneIndex)
{
Bone& bone = m_Bones[boneIndex];
VQS vqs;
anim.CalculateTransform(time, boneIndex, vqs, trackData[boneIndex]);
XMFLOAT4X4 parentTransform = bone.ParentBoneIndex != -1 ? buffer[bone.ParentBoneIndex] : identity;
XMFLOAT4X4 localTransform = vqs.GetMatrix();
XMFLOAT4X4 modelTransform; // = localTransform * parentTransform;
XMStoreFloat4x4(&modelTransform, XMMatrixMultiply(XMLoadFloat4x4(&localTransform), XMLoadFloat4x4(&parentTransform)));
buffer[boneIndex] = modelTransform;
}
}