Animation
Go to the documentation of this file.
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGANIMATION_ANIMATION
#define OSGANIMATION_ANIMATION 1
#include <osg/Object>
#include <osgAnimation/Export>
#include <osgAnimation/Channel>
#include <osg/ref_ptr>
#include <vector>
#include <map>
namespace osgAnimation
{
class OSGANIMATION_EXPORT Animation : public osg::Object
{
public:
META_Object(osgAnimation, Animation)
Animation() :
_duration(0.0), _originalDuration(0.0),
_weight(0), _startTime(0), _playmode(LOOP) {}
Animation(const osgAnimation::Animation&, const osg::CopyOp&);
enum PlayMode
{
ONCE,
STAY,
LOOP,
PPONG
};
// addChannel insert the channel and call the computeDuration function
void addChannel (Channel* pChannel);
// removeChannel remove the channel from channels list and call the computeDuration function
void removeChannel (Channel* pChannel);
ChannelList& getChannels();
const ChannelList& getChannels() const;
void setDuration(double duration);
void computeDuration();
double getDuration() const;
double computeDurationFromChannels() const;
void setWeight (float weight);
float getWeight() const;
bool update (double time, int priority = 0);
void resetTargets();
void setPlayMode (PlayMode mode) { _playmode = mode; }
PlayMode getPlayMode() const { return _playmode; }
void setStartTime(double time) { _startTime = time;}
double getStartTime() const { return _startTime;}
protected:
~Animation() {}
double _duration;
double _originalDuration;
float _weight;
double _startTime;
PlayMode _playmode;
ChannelList _channels;
};
typedef std::vector<osg::ref_ptr<osgAnimation::Animation> > AnimationList;
typedef std::map<std::string, osg::ref_ptr<osgAnimation::Animation> > AnimationMap;
}
#endif
Channel
Object
osgAnimation::Animation
Definition Animation:29
osgAnimation::Animation::getPlayMode
PlayMode getPlayMode() const
Definition Animation:82
osgAnimation::Animation::update
bool update(double time, int priority=0)
osgAnimation::Animation::setStartTime
void setStartTime(double time)
Definition Animation:84
osgAnimation::Animation::computeDurationFromChannels
double computeDurationFromChannels() const
osgAnimation::Animation::getWeight
float getWeight() const
osgAnimation::Animation::_duration
double _duration
Definition Animation:91
osgAnimation::Animation::getDuration
double getDuration() const
osgAnimation::Animation::_originalDuration
double _originalDuration
Definition Animation:92
osgAnimation::Animation::Animation
Animation(const osgAnimation::Animation &, const osg::CopyOp &)
osgAnimation::Animation::resetTargets
void resetTargets()
osgAnimation::Animation::removeChannel
void removeChannel(Channel *pChannel)
osgAnimation::Animation::~Animation
~Animation()
Definition Animation:89
osgAnimation::Animation::getStartTime
double getStartTime() const
Definition Animation:85
osgAnimation::Animation::addChannel
void addChannel(Channel *pChannel)
osgAnimation::Animation::getChannels
const ChannelList & getChannels() const
osgAnimation::Animation::_channels
ChannelList _channels
Definition Animation:96
osgAnimation::Animation::setPlayMode
void setPlayMode(PlayMode mode)
Definition Animation:81
osgAnimation::Animation::_playmode
PlayMode _playmode
Definition Animation:95
osgAnimation::Animation::getChannels
ChannelList & getChannels()
osgAnimation::Animation::META_Object
META_Object(osgAnimation, Animation) Animation()
Definition Animation:31
osgAnimation::Animation::setWeight
void setWeight(float weight)
osgAnimation::Animation::PlayMode
PlayMode
Definition Animation:40
osgAnimation::Animation::STAY
@ STAY
Definition Animation:42
osgAnimation::Animation::PPONG
@ PPONG
Definition Animation:44
osgAnimation::Animation::ONCE
@ ONCE
Definition Animation:41
osgAnimation::Animation::LOOP
@ LOOP
Definition Animation:43
osgAnimation::Animation::setDuration
void setDuration(double duration)
osgAnimation::Animation::_weight
float _weight
Definition Animation:93
osgAnimation::Animation::_startTime
double _startTime
Definition Animation:94
osgAnimation::Animation::computeDuration
void computeDuration()
osgAnimation::Channel
Definition Channel:33
osg::CopyOp
Definition CopyOp:41
osg::Object
Definition Object:61
osgAnimation
Definition Action:34
osgAnimation::AnimationList
std::vector< osg::ref_ptr< osgAnimation::Animation > > AnimationList
Definition Animation:100
osgAnimation::AnimationMap
std::map< std::string, osg::ref_ptr< osgAnimation::Animation > > AnimationMap
Definition Animation:101
osgAnimation::ChannelList
std::vector< osg::ref_ptr< osgAnimation::Channel > > ChannelList
Definition Channel:168
Export
OSGANIMATION_EXPORT
#define OSGANIMATION_EXPORT
Definition osgAnimation/Export:40
ref_ptr