本文整理汇总了C++中osg::ref_ptr::getAnimationList方法的典型用法代码示例。如果您正苦于以下问题:C++ ref_ptr::getAnimationList方法的具体用法?C++ ref_ptr::getAnimationList怎么用?C++ ref_ptr::getAnimationList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::ref_ptr
的用法示例。
在下文中一共展示了ref_ptr::getAnimationList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addChannel
void addChannel(
osgAnimation::Channel* pChannel,
osg::ref_ptr<osgAnimation::AnimationManagerBase>& pAnimManager,
const char* pTakeName)
{
if (!pChannel)
{
return;
}
if (!pAnimManager) pAnimManager = new osgAnimation::BasicAnimationManager;
osgAnimation::Animation* pAnimation = 0;
const osgAnimation::AnimationList& anims = pAnimManager->getAnimationList();
for (size_t i = 0; i < anims.size(); ++i)
{
if (anims[i]->getName() == pTakeName)
{
pAnimation = anims[i].get();
}
}
if (!pAnimation)
{
pAnimation = new osgAnimation::Animation;
pAnimation->setName(pTakeName);
pAnimManager->registerAnimation(pAnimation);
}
pAnimation->addChannel(pChannel);
}
示例2: ExampleTimelineUsage
ExampleTimelineUsage(osgAnimation::TimelineAnimationManager* manager)
{
_releaseKey = false;
_manager = manager;
const osgAnimation::AnimationList& list = _manager->getAnimationList();
osgAnimation::AnimationMap map;
for (osgAnimation::AnimationList::const_iterator it = list.begin(); it != list.end(); it++)
map[(*it)->getName()] = *it;
_mainLoop = new osgAnimation::ActionStripAnimation(map["Idle_Main"].get(),0.0,0.0);
_mainLoop->setLoop(0); // means forever
_scratchHead = new osgAnimation::ActionStripAnimation(map["Idle_Head_Scratch.02"].get(),0.2,0.3);
_scratchHead->setLoop(1); // one time
map["Idle_Nose_Scratch.01"]->setDuration(10.0); // set this animation duration to 10 seconds
_scratchNose = new osgAnimation::ActionStripAnimation(map["Idle_Nose_Scratch.01"].get(),0.2,0.3);
_scratchNose->setLoop(1); // one time
// add the main loop at priority 0 at time 0.
osgAnimation::Timeline* tml = _manager->getTimeline();
tml->play();
tml->addActionAt(0.0, _mainLoop.get(), 0);
// add a scratch head priority 1 at 3.0 second.
tml->addActionAt(5.0, _scratchHead.get(), 1);
// populate time with scratch head
for (int i = 1; i < 20; i++)
{
// we add a scratch head priority 1 each 10 second
// note:
// it's possible to add the same instance more then once on the timeline
// the only things you need to take care is if you remove it. It will remove
// all instance that exist on the timeline. If you need to differtiate
// it's better to create a new instance
tml->addActionAt(5.0 + 10.0 * i, _scratchHead.get(), 1);
}
// we will add the scratch nose action only when the player hit a key
// in the operator()
// now we will add callback at end and begin of animation of Idle_Nose_Scratch.02
_scratchNose->setCallback(0.0, new NoseBegin);
_scratchNose->setCallback(_scratchNose->getNumFrames()-1, new NoseEnd);
}