2012-03-22 01:36:20 +08:00
|
|
|
/* -*-c++-*-
|
2009-07-23 20:42:01 +08:00
|
|
|
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
|
2008-11-22 20:14:19 +08:00
|
|
|
*
|
2012-03-22 01:36:20 +08:00
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
2008-11-22 20:14:19 +08:00
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
2012-03-22 01:36:20 +08:00
|
|
|
*
|
2008-11-22 20:14:19 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2012-03-22 01:36:20 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2008-11-22 20:14:19 +08:00
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSGANIMATION_NODE_VISITOR_H
|
|
|
|
#define OSGANIMATION_NODE_VISITOR_H
|
|
|
|
|
|
|
|
#include <osg/NodeVisitor>
|
2009-08-03 17:48:12 +08:00
|
|
|
#include <osg/StateSet>
|
2008-11-22 20:14:19 +08:00
|
|
|
#include <osgAnimation/Animation>
|
|
|
|
|
2012-03-22 01:36:20 +08:00
|
|
|
namespace osgAnimation
|
2008-11-22 20:14:19 +08:00
|
|
|
{
|
2009-08-03 17:48:12 +08:00
|
|
|
class AnimationUpdateCallbackBase;
|
|
|
|
|
2009-07-23 20:42:01 +08:00
|
|
|
/** This class is instancied by the AnimationManagerBase, it will link animation target to updatecallback that have the same name
|
|
|
|
*/
|
|
|
|
class OSGANIMATION_EXPORT LinkVisitor : public osg::NodeVisitor
|
2008-11-22 20:14:19 +08:00
|
|
|
{
|
2009-07-23 20:42:01 +08:00
|
|
|
public:
|
|
|
|
LinkVisitor();
|
|
|
|
|
|
|
|
META_NodeVisitor("osgAnimation","LinkVisitor");
|
|
|
|
|
|
|
|
void apply(osg::Node& node);
|
2009-08-03 17:48:12 +08:00
|
|
|
void apply(osg::Geode& node);
|
|
|
|
|
2009-07-23 20:42:01 +08:00
|
|
|
AnimationList& getAnimationList();
|
|
|
|
void reset();
|
2009-08-31 17:40:56 +08:00
|
|
|
unsigned int getNbLinkedTarget() const { return _nbLinkedTarget; }
|
2009-07-23 20:42:01 +08:00
|
|
|
|
|
|
|
protected:
|
2009-08-03 17:48:12 +08:00
|
|
|
|
|
|
|
void handle_stateset(osg::StateSet* stateset);
|
|
|
|
void link(osgAnimation::AnimationUpdateCallbackBase* cb);
|
|
|
|
|
2009-07-23 20:42:01 +08:00
|
|
|
// animation list to link
|
2008-11-22 20:14:19 +08:00
|
|
|
AnimationList _animations;
|
2009-07-23 20:42:01 +08:00
|
|
|
|
|
|
|
// number of success link done
|
2008-11-22 20:14:19 +08:00
|
|
|
unsigned int _nbLinkedTarget;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|