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.
|
|
|
|
*/
|
|
|
|
|
2009-12-10 02:45:46 +08:00
|
|
|
#ifndef OSGANIMATION_ANIMATION_MANAGER_BASE
|
|
|
|
#define OSGANIMATION_ANIMATION_MANAGER_BASE 1
|
2008-11-22 20:14:19 +08:00
|
|
|
|
2009-07-23 20:42:01 +08:00
|
|
|
#include <osgAnimation/LinkVisitor>
|
2008-11-22 20:14:19 +08:00
|
|
|
#include <osgAnimation/Animation>
|
|
|
|
#include <osgAnimation/Export>
|
|
|
|
#include <osg/FrameStamp>
|
|
|
|
#include <osg/Group>
|
|
|
|
|
2008-12-17 04:29:00 +08:00
|
|
|
|
|
|
|
|
2008-11-22 20:14:19 +08:00
|
|
|
namespace osgAnimation
|
|
|
|
{
|
2008-12-17 04:29:00 +08:00
|
|
|
class OSGANIMATION_EXPORT AnimationManagerBase : public osg::NodeCallback
|
2008-11-22 20:14:19 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef std::set<osg::ref_ptr<Target> > TargetSet;
|
|
|
|
|
|
|
|
AnimationManagerBase();
|
2008-12-17 04:29:00 +08:00
|
|
|
AnimationManagerBase(const AnimationManagerBase& b, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY);
|
2008-11-22 20:14:19 +08:00
|
|
|
virtual ~AnimationManagerBase();
|
|
|
|
virtual void buildTargetReference();
|
2009-08-27 00:39:53 +08:00
|
|
|
virtual void registerAnimation (Animation*);
|
|
|
|
virtual void unregisterAnimation (Animation*);
|
2008-12-17 04:29:00 +08:00
|
|
|
virtual void link(osg::Node* subgraph);
|
|
|
|
virtual void update(double t) = 0;
|
2008-11-22 20:14:19 +08:00
|
|
|
virtual bool needToLink() const;
|
|
|
|
const AnimationList& getAnimationList() const { return _animations;}
|
|
|
|
|
2008-12-17 04:29:00 +08:00
|
|
|
/** Callback method called by the NodeVisitor when visiting a node.*/
|
|
|
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
|
|
|
|
|
2009-10-21 23:45:13 +08:00
|
|
|
/** Reset the value of targets
|
|
|
|
this Operation must be done each frame */
|
2008-12-17 04:29:00 +08:00
|
|
|
void clearTargets();
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2008-11-22 20:14:19 +08:00
|
|
|
|
2009-07-23 20:42:01 +08:00
|
|
|
LinkVisitor* getOrCreateLinkVisitor();
|
|
|
|
void setLinkVisitor(LinkVisitor*);
|
|
|
|
|
2009-10-21 23:45:13 +08:00
|
|
|
/// set a flag to define the behaviour
|
|
|
|
void setAutomaticLink(bool);
|
From Wang Rui, "Attached is the osgAnimation wrappers for serialize IO operations. A
few headers and the osgAnimation sources are also modified to make
everything goes well, including:
A new REGISTER_OBJECT_WRAPPER2 macro to wrap classes like
Skeleton::UpdateSkeleton.
A bug fix in the Seralizer header which avoids setting default values
to objects.
Naming style fixes in osgAnimation headers and sources, also in the
deprecated dotosg wrappers.
A bug fix for the XML support, to write char values correctly.
A small change in the osg::Geometry wrapper to ignore the
InternalGeometry property, which is used by the MorphGeometry and
should not be set by user applications.
The avatar.osg, nathan.osg and robot.osg data files all work fine with
serializers, with some 'unsupported wrapper' warnings when converting.
I'm thinking of removing these warnings by disabling related property
serializers (ComputeBoundingBoxCallback and Drawable::UpdateCallback),
which are seldom recorded by users.
By the way, I still wonder how would we handle the C4121 problem,
discussed some days before. The /Zp compile option is set to 16 in the
attached cmake script file. And is there a better solution now?"
2010-04-19 18:35:18 +08:00
|
|
|
bool getAutomaticLink() const;
|
|
|
|
bool isAutomaticLink() const { return getAutomaticLink(); }
|
2009-10-21 23:45:13 +08:00
|
|
|
void dirty();
|
|
|
|
|
2008-11-22 20:14:19 +08:00
|
|
|
protected:
|
|
|
|
|
2009-07-23 20:42:01 +08:00
|
|
|
osg::ref_ptr<LinkVisitor> _linker;
|
2008-11-22 20:14:19 +08:00
|
|
|
AnimationList _animations;
|
|
|
|
TargetSet _targets;
|
|
|
|
bool _needToLink;
|
2009-10-21 23:45:13 +08:00
|
|
|
bool _automaticLink;
|
2008-11-22 20:14:19 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|