2
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
4
* This library is open source and may be redistributed and/or modified under
5
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
6
* (at your option) any later version. The full license is in LICENSE file
7
* included with this distribution, and on the openscenegraph.org website.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* OpenSceneGraph Public License for more details.
15
#ifndef OSGANIMATION_UPDATE_CALLBACK_H
16
#define OSGANIMATION_UPDATE_CALLBACK_H
19
#include <osg/NodeCallback>
20
#include <osg/observer_ptr>
21
#include <osgAnimation/AnimationManagerBase>
22
#include <osgAnimation/Export>
24
namespace osgAnimation
27
class OSGANIMATION_EXPORT AnimationUpdateCallback : public osg::NodeCallback
30
osg::observer_ptr<osgAnimation::AnimationManagerBase> _manager;
33
AnimationUpdateCallback(const std::string& name = "") { setName(name); }
34
AnimationUpdateCallback(const AnimationUpdateCallback& apc,const osg::CopyOp& copyop);
35
osgAnimation::AnimationManagerBase* getAnimationManager();
36
virtual bool needLink() const = 0;
37
virtual bool link(osgAnimation::Channel* channel) = 0;
38
virtual int link(osgAnimation::Animation* animation);
39
virtual void updateLink();
43
class OSGANIMATION_EXPORT UpdateTransform : public AnimationUpdateCallback
46
osg::ref_ptr<osgAnimation::Vec3Target> _euler;
47
osg::ref_ptr<osgAnimation::Vec3Target> _position;
48
osg::ref_ptr<osgAnimation::Vec3Target> _scale;
52
META_Object(osgAnimation, UpdateTransform);
54
UpdateTransform(const std::string& name = "");
55
UpdateTransform(const UpdateTransform& apc,const osg::CopyOp& copyop);
57
/** Callback method called by the NodeVisitor when visiting a node.*/
58
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
59
void update(osg::MatrixTransform& mat);
60
void update(osg::PositionAttitudeTransform& pat);
61
bool needLink() const;
62
bool link(osgAnimation::Channel* channel);