本文整理汇总了C++中KeyframeAnimatorRecPtr类的典型用法代码示例。如果您正苦于以下问题:C++ KeyframeAnimatorRecPtr类的具体用法?C++ KeyframeAnimatorRecPtr怎么用?C++ KeyframeAnimatorRecPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KeyframeAnimatorRecPtr类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupAnimation
AnimationTransitPtr setupAnimation(const std::vector<Pnt3f>& Path, Transform* const transCore)
{
//Transformation Keyframe Sequence
KeyframeTransformationSequenceRecPtr TransformationKeyframes = KeyframeTransformationSequenceMatrix4f::create();
Matrix TempMat;
TempMat.setScale(0.06f);
Real32 Speed(1.0f);
Real32 SeqTime;
Real32 TotalPathDistance(0.0f);
for(UInt32 i(0) ; i<Path.size()-1 ; ++i)
{
TotalPathDistance += Path[i].dist(Path[(i+1)]);
}
Real32 CumPathDistance(0.0f);
Quaternion Rotation;
Vec3f Direction;
for(UInt32 i(0) ; i<Path.size() ; ++i)
{
SeqTime = CumPathDistance / Speed;
Direction = Path[(i+1)%Path.size()]-Path[i];
Direction[1] = 0.0f;
Direction.normalize();
Rotation = Quaternion(Vec3f(0.0f,0.0f,1.0f),Direction);
TempMat.setTransform(Vec3f(Path[i]),Rotation,Vec3f(0.1f,0.1f,0.1f));
TransformationKeyframes->addKeyframe(TempMat,SeqTime);
if(i<Path.size()-1)
{
CumPathDistance += Path[i].dist(Path[(i+1)]);
}
}
//Animator
KeyframeAnimatorRecPtr TheAnimator = KeyframeAnimator::create();
TheAnimator->setKeyframeSequence(TransformationKeyframes);
//Animation
FieldAnimationRecPtr TheAnimation = FieldAnimation::create();
TheAnimation->setAnimator(TheAnimator);
TheAnimation->setInterpolationType(Animator::LINEAR_INTERPOLATION);
TheAnimation->setCycling(1);
TheAnimation->setAnimatedField(transCore, std::string("matrix"));
return AnimationTransitPtr(TheAnimation);
}
示例2: makeDocForeground
SimpleScreenDoc::SimpleScreenDoc(SimpleSceneManager* SceneManager,
WindowEventProducer* MainWindow)
{
_DocForeground = makeDocForeground();
_DocForeground->setBgColor(Color4f(0.0f,0.0f,0.0f,0.8f));
_DocForeground->setBorderColor(Color4f(1.0f,1.0f,1.0f,1.0f));
_DocForeground->setTextMargin(Vec2f(5.0f,5.0f));
_DocForeground->setHorizontalAlign(SimpleTextForeground::Left);
_DocForeground->setVerticalAlign(SimpleTextForeground::Top);
_DocForeground->setActive(false);
_DocShowForeground = makeDocShowForeground();
ViewportRefPtr TutorialViewport = SceneManager->getWindow()->getPort(0);
TutorialViewport->addForeground(_DocForeground);
TutorialViewport->addForeground(_DocShowForeground);
MainWindow->connectKeyTyped(boost::bind(&SimpleScreenDoc::keyTyped,
this,
_1));
//Color Keyframe Sequence
KeyframeColorSequenceRecPtr ColorKeyframes = KeyframeColorSequenceColor4f::create();
ColorKeyframes->addKeyframe(Color4f(1.0f,1.0f,1.0f,1.0f),0.0f);
ColorKeyframes->addKeyframe(Color4f(1.0f,1.0f,1.0f,1.0f),5.0f);
ColorKeyframes->addKeyframe(Color4f(1.0f,1.0f,1.0f,0.0f),7.0f);
//Animator
KeyframeAnimatorRecPtr TheAnimator = KeyframeAnimator::create();
TheAnimator->setKeyframeSequence(ColorKeyframes);
//Animation
_ShowDocFadeOutAnimation = FieldAnimation::create();
_ShowDocFadeOutAnimation->setAnimator(TheAnimator);
_ShowDocFadeOutAnimation->setInterpolationType(Animator::LINEAR_INTERPOLATION);
_ShowDocFadeOutAnimation->setCycling(1);
_ShowDocFadeOutAnimation->setAnimatedField(_DocShowForeground,
SimpleTextForeground::ColorFieldId);
_ShowDocFadeOutAnimation->attachUpdateProducer(MainWindow);
_ShowDocFadeOutAnimation->start();
}
示例3: setupAnimation
AnimationTransitPtr setupAnimation(Transform* const transCore, WindowEventProducer* const win)
{
//Number Keyframe Sequence
KeyframeNumberSequenceRecPtr NumberKeyframes = KeyframeNumberSequenceReal32::create();
NumberKeyframes->addKeyframe(1.0,0.0f);
NumberKeyframes->addKeyframe(60.0,1.0f);
NumberKeyframes->addKeyframe(20.0,2.0f);
NumberKeyframes->addKeyframe(1.0,3.0f);
//Color Keyframe Sequence
KeyframeColorSequenceRecPtr ColorKeyframes = KeyframeColorSequenceColor3f::create();
ColorKeyframes->addKeyframe(Color4f(1.0f,0.0f,0.0f,1.0f),0.0f);
ColorKeyframes->addKeyframe(Color4f(0.0f,1.0f,0.0f,1.0f),2.0f);
ColorKeyframes->addKeyframe(Color4f(0.0f,0.0f,1.0f,1.0f),4.0f);
ColorKeyframes->addKeyframe(Color4f(1.0f,0.0f,0.0f,1.0f),6.0f);
//Position Keyframe Sequence
KeyframePositionSequenceRecPtr PositionKeyframes = KeyframePositionSequencePnt3f::create();
PositionKeyframes->addKeyframe(Pnt3f(1.0f,1.0f,1.0f),0.0f);
PositionKeyframes->addKeyframe(Pnt3f(0.5f,1.0f,0.5f),1.0f);
PositionKeyframes->addKeyframe(Pnt3f(1.0f,1.0f,0.5f),2.0f);
PositionKeyframes->addKeyframe(Pnt3f(1.0f,0.5f,0.5f),3.0f);
PositionKeyframes->addKeyframe(Pnt3f(1.0f,1.0f,1.0f),4.0f);
//Vector Keyframe Sequence
KeyframeVectorSequenceRecPtr VectorKeyframes = KeyframeVectorSequenceVec3f::create();
VectorKeyframes->addKeyframe(Vec3f(1.0f,1.0f,1.0f),0.0f);
VectorKeyframes->addKeyframe(Vec3f(0.5f,1.0f,0.5f),1.0f);
VectorKeyframes->addKeyframe(Vec3f(1.0f,1.0f,0.5f),2.0f);
VectorKeyframes->addKeyframe(Vec3f(1.0f,0.5f,0.5f),3.0f);
VectorKeyframes->addKeyframe(Vec3f(1.0f,1.0f,1.0f),4.0f);
//Rotation Keyframe Sequence
KeyframeRotationSequenceRecPtr RotationKeyframes = KeyframeRotationSequenceQuaternion::create();
RotationKeyframes->addKeyframe(Quaternion(Vec3f(0.0f,1.0f,0.0f), 3.14159f*0.0f),0.0f);
RotationKeyframes->addKeyframe(Quaternion(Vec3f(0.0f,1.0f,0.0f), 3.14159f*0.5f),1.0f);
RotationKeyframes->addKeyframe(Quaternion(Vec3f(0.0f,1.0f,0.0f), 3.14159f*1.0f),2.0f);
RotationKeyframes->addKeyframe(Quaternion(Vec3f(0.0f,1.0f,0.0f), 3.14159f*1.5f),3.0f);
RotationKeyframes->addKeyframe(Quaternion(Vec3f(0.0f,1.0f,0.0f), 3.14159f*2.0f),4.0f);
//Transformation Keyframe Sequence
KeyframeTransformationSequenceRecPtr TransformationKeyframes = KeyframeTransformationSequenceMatrix4f::create();
Matrix TempMat;
TempMat.setTransform(Vec3f(0.0f,0.0f,0.0f), Quaternion(Vec3f(0.0f,1.0f,0.0f), 3.14159f*0.0f));
TransformationKeyframes->addKeyframe(TempMat,0.0f);
TempMat.setTransform(Vec3f(0.0f,1.0f,0.0f), Quaternion(Vec3f(0.0f,1.0f,0.0f), 3.14159f*0.5f));
TransformationKeyframes->addKeyframe(TempMat,1.0f);
TempMat.setTransform(Vec3f(1.0f,1.0f,0.0f), Quaternion(Vec3f(0.0f,1.0f,0.0f), 3.14159f*1.0f));
TransformationKeyframes->addKeyframe(TempMat,2.0f);
TempMat.setTransform(Vec3f(1.0f,0.0f,0.0f), Quaternion(Vec3f(0.0f,1.0f,0.0f), 3.14159f*1.5f));
TransformationKeyframes->addKeyframe(TempMat,3.0f);
TempMat.setTransform(Vec3f(0.0f,0.0f,0.0f), Quaternion(Vec3f(0.0f,1.0f,0.0f), 3.14159f*2.0f));
TransformationKeyframes->addKeyframe(TempMat,4.0f);
//Animator
KeyframeAnimatorRecPtr TheAnimator = KeyframeAnimator::create();
//TheAnimator->setKeyframeSequence(VectorKeyframes);
//TheAnimator->setKeyframeSequence(RotationKeyframes);
//TheAnimator->setKeyframeSequence(ColorKeyframes);
TheAnimator->setKeyframeSequence(TransformationKeyframes);
//TheAnimator->setKeyframeSequence(NumberKeyframes);
//Animation
FieldAnimationRecPtr TheAnimation = FieldAnimation::create();
TheAnimation->setAnimator(TheAnimator);
TheAnimation->setInterpolationType(Animator::LINEAR_INTERPOLATION);
TheAnimation->setCycling(2);
//TheAnimation->setAnimatedField(getFieldContainer("Transform",std::string("TorusNodeTransformationCore")), std::string("matrix"));
//TheAnimation->setAnimatedField(Trans, std::string("scale"));
//TheAnimation->setAnimatedField(Trans, std::string("rotation"));
//TheAnimation->setAnimatedField(TheTorusMaterial, std::string("diffuse"));
//TheAnimation->setAnimatedField(TheTorusMaterial, std::string("shininess"));
TheAnimation->setAnimatedField(transCore, std::string("matrix"));
AnimationGroupRecPtr TheAnimationGroup = AnimationGroup::create();
TheAnimationGroup->pushToAnimations(TheAnimation);
TheAnimationGroup->setCycling(2);
TheAnimationGroup->attachUpdateProducer(win);
TheAnimationGroup->start();
return AnimationTransitPtr(TheAnimationGroup);
}