本文整理汇总了C++中CAnimation::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CAnimation::Add方法的具体用法?C++ CAnimation::Add怎么用?C++ CAnimation::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAnimation
的用法示例。
在下文中一共展示了CAnimation::Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Convert
BOOL CAnimationConverter::Convert(CMovement** ppcMovement, CSequence* pcSequence, SMatrix* psMatrix)
{
CAnimKeyFrame* pcAnimKeyFrame;
CAnimKeyFrame* pcAnimKeyFramePrev;
int i;
CAnimation* pcAnimation;
int iNumFrames;
CTransformNodeInterpolator* psMatrixInterpolator;
CMovement* pcMovement;
CTransformNode* pcMatrix;
//Something, Something, Something... IsAnimationConverted() ... blah...
pcMovement = mpcSceneConverter->GetWorld()->CreateMovement();
pcAnimation = NULL;
pcAnimKeyFramePrev = NULL;
iNumFrames = pcSequence->masKeyFrames.NumElements();
for (i = 0; i < iNumFrames; i++)
{
pcAnimKeyFrame = pcSequence->masKeyFrames.Get(i);
if (pcAnimKeyFrame->miType & KFT_Matrix)
{
//If we don't yet have an animation then create one.
if (pcAnimation == NULL)
{
pcAnimation = mpcSceneConverter->GetWorld()->CreateAnimation(iNumFrames/3 + 1);
}
//Only if we already have a position key can we create a position animation.
if (pcAnimKeyFramePrev)
{
//This is because the start and end points are needed by pcPosition.
pcMatrix = mpcSceneConverter->GetWorld()->CreateAnimMatrix();
psMatrixInterpolator = (CTransformNodeInterpolator*)pcMatrix->Set(MT_SphericalLinearMatrix);
pcAnimation->Add(pcMatrix, pcAnimKeyFrame->mfTime, -1, MatrixFunction, NULL);
psMatrixInterpolator->msPosition1 = ((SAnimKeyFrameMatrix*)(&pcAnimKeyFramePrev->msf))->msMatrix;
psMatrixInterpolator->msPosition2 = ((SAnimKeyFrameMatrix*)(&pcAnimKeyFrame->msf))->msMatrix;
psMatrixInterpolator->mfExponential = 1.0f;
}
pcAnimKeyFramePrev = pcAnimKeyFrame;
}
}
if (pcAnimation)
{
pcAnimation->MakeLoopingAnimation();
}
pcMovement->SetType(MT_Matrix);
pcMovement->SetMatrixAnimation(pcAnimation);
pcMovement->SetPositionAnimation(NULL);
pcMovement->SetRotationAnimation(NULL);
pcMovement->SetOffset(NULL);
pcMovement->SetOutput(psMatrix);
pcMovement->Restart();
pcMovement->Update();
if (ppcMovement)
{
*ppcMovement = pcMovement;
}
return TRUE;
}