本文整理汇总了C++中Bone::Index方法的典型用法代码示例。如果您正苦于以下问题:C++ Bone::Index方法的具体用法?C++ Bone::Index怎么用?C++ Bone::Index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bone
的用法示例。
在下文中一共展示了Bone::Index方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetInterpolatedPose
void AnimationPlayer::GetInterpolatedPose(float time, SceneNode& sceneNode)
{
XMFLOAT4X4 toParentTransform;
Bone* bone = sceneNode.As<Bone>();
if (bone != nullptr)
{
mCurrentClip->GetInteropolatedTransform(time, *bone, toParentTransform);
}
else
{
toParentTransform = sceneNode.Transform();
}
XMMATRIX toRootTransform = (sceneNode.GetParent() != nullptr ? XMLoadFloat4x4(&toParentTransform) * XMLoadFloat4x4(&(mToRootTransforms.at(sceneNode.GetParent()))) : XMLoadFloat4x4(&toParentTransform));
XMStoreFloat4x4(&(mToRootTransforms[&sceneNode]), toRootTransform);
if (bone != nullptr)
{
XMStoreFloat4x4(&(mFinalTransforms[bone->Index()]), bone->OffsetTransformMatrix() * toRootTransform * XMLoadFloat4x4(&mInverseRootTransform));
}
for (auto& childNode : sceneNode.Children())
{
GetInterpolatedPose(time, *childNode);
}
}
示例2: Load
void Model::Load(std::fstream& fileStream)
{
uint_t size;
//read the material data first, since mesh is dependent on material
ModelDeSerializer::ReadAsBytes(fileStream, size);
mMaterials.reserve(size);
for (int i = 0; i < size; i++)
{
mMaterials.push_back(new ModelMaterial(*this, fileStream));
}
//read the mesh data
ModelDeSerializer::ReadAsBytes(fileStream, size);
mMeshes.reserve(size);
for (int i = 0; i < size; i++)
{
mMeshes.push_back(new Mesh(*this, fileStream));
}
bool hasSkeleton;
ModelDeSerializer::ReadAsBytes(fileStream, hasSkeleton);
if (hasSkeleton)
{
ModelDeSerializer::ReadAsBytes(fileStream, size);
mBones.reserve(size);
for (int i = 0; i < size; i++)
{
Bone* bone = new Bone(*this, fileStream);
mBones.push_back(bone);
mBoneIndexMapping[bone->Name()] = bone->Index();
}
LoadSkeleton(fileStream, mRootNode);
ModelDeSerializer::ReadAsBytes(fileStream, size);
mAnimations.reserve(size);
for (int i = 0; i < size; i++)
{
AnimationClip* clip = new AnimationClip(*this, fileStream);
mAnimations.push_back(clip);
mAnimationsByName.insert(std::pair<std::string, AnimationClip*>(clip->Name(), clip));
}
}
}
示例3: GetBindPose
void AnimationPlayer::GetBindPose(SceneNode& sceneNode)
{
XMMATRIX toParentTransform = sceneNode.TransformMatrix();
XMMATRIX toRootTransform = (sceneNode.GetParent() != nullptr ? toParentTransform * XMLoadFloat4x4(&(mToRootTransforms.at(sceneNode.GetParent()))) : toParentTransform);
XMStoreFloat4x4(&(mToRootTransforms[&sceneNode]), toRootTransform);
Bone* bone = sceneNode.As<Bone>();
if (bone != nullptr)
{
XMStoreFloat4x4(&(mFinalTransforms[bone->Index()]), bone->OffsetTransformMatrix() * toRootTransform * XMLoadFloat4x4(&mInverseRootTransform));
}
for (auto& childNode : sceneNode.Children())
{
GetBindPose(*childNode);
}
}
示例4: GetBindPoseBottomUp
void AnimationPlayer::GetBindPoseBottomUp(SceneNode& sceneNode)
{
XMMATRIX toRootTransform = sceneNode.TransformMatrix();
SceneNode* parentNode = sceneNode.GetParent();
while (parentNode != nullptr)
{
toRootTransform = toRootTransform * parentNode->TransformMatrix();
parentNode = parentNode->GetParent();
}
Bone* bone = sceneNode.As<Bone>();
if (bone != nullptr)
{
XMStoreFloat4x4(&(mFinalTransforms[bone->Index()]), bone->OffsetTransformMatrix() * toRootTransform * XMLoadFloat4x4(&mInverseRootTransform));
}
for (auto& childNode : sceneNode.Children())
{
GetBindPoseBottomUp(*childNode);
}
}