本文整理汇总了C++中SkeletonAnimation::Update方法的典型用法代码示例。如果您正苦于以下问题:C++ SkeletonAnimation::Update方法的具体用法?C++ SkeletonAnimation::Update怎么用?C++ SkeletonAnimation::Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkeletonAnimation
的用法示例。
在下文中一共展示了SkeletonAnimation::Update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
bool AnimationController::Update(Mesh * mesh, float elapsedTime)
{
float lastPosition = mPosition;
mPosition += elapsedTime * mBlendInfo.Speed;
if (!IsBlendOut())
{
if (mWeightBlendInDelta == 0)
{
mWeight = 1;
}
else
{
mWeight += elapsedTime * mWeightBlendInDelta;
if (mWeight >= 1)
{
mWeight = 1;
mWeightBlendInDelta = 0;
}
}
}
else
{
if (mWeight == 0)
return false;
if (mWeightBlendOutDelta > 0)
{
mWeight -= elapsedTime * mWeightBlendOutDelta;
mWeight = Max(0.0f, mWeight);
}
}
//
if (mCatchedAnim == NULL && mesh->GetSource() != NULL)
{
mCatchedAnim = mesh->GetSource()->GetAnimation(mName.c_str());
if (mCatchedAnim == NULL)
return true;
mSkelAnimLastKeys.Resize(mCatchedAnim->GetSkeletonAnimationCount());
for (int i = 0; i < mSkelAnimLastKeys.Size(); ++i)
mSkelAnimLastKeys[i] = -1;
}
if (mCatchedAnim != NULL)
{
float length = mCatchedAnim->GetLength();
if (mPosition >= length)
{
if (mBlendInfo.Looped)
{
while (mPosition > length)
mPosition -= length;
for (int i = 0; i < mSkelAnimLastKeys.Size(); ++i)
mSkelAnimLastKeys[i] = -1;
}
else
{
mPosition = length;
return false;
}
}
for (int i = 0; i < mCatchedAnim->GetEventCount(); ++i)
{
Animation::Event * e = mCatchedAnim->GetEvent(i);
if (e->time > lastPosition && e->time <= mPosition)
E_Event(e);
}
Skeleton * skel = mesh->GetSkeleton().c_ptr();
if (skel != NULL && !mesh->IsSkeletonShared())
{
for (int i = 0; i < mCatchedAnim->GetSkeletonAnimationCount(); ++i)
{
SkeletonAnimation * skelAnim = mCatchedAnim->GetSkeletonAnimation(i);
skelAnim->Update(skel, this, mSkelAnimLastKeys[i]);
}
}
}
return true;
}