OpenSceneGraph 3.6.5
Animation
Go to the documentation of this file.
1/* -*-c++-*-
2 * Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
3 *
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.
8 *
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.
13*/
14
15#ifndef OSGANIMATION_ANIMATION
16#define OSGANIMATION_ANIMATION 1
17
18#include <osg/Object>
19#include <osgAnimation/Export>
20#include <osgAnimation/Channel>
21#include <osg/ref_ptr>
22#include <vector>
23#include <map>
24
25namespace osgAnimation
26{
27
29 {
30 public:
36
38
46
47 // addChannel insert the channel and call the computeDuration function
48 void addChannel (Channel* pChannel);
49
50 // removeChannel remove the channel from channels list and call the computeDuration function
51 void removeChannel (Channel* pChannel);
52
58 const ChannelList& getChannels() const;
59
65 void setDuration(double duration);
66
72 double getDuration() const;
74
75 void setWeight (float weight);
76 float getWeight() const;
77
78 bool update (double time, int priority = 0);
80
81 void setPlayMode (PlayMode mode) { _playmode = mode; }
82 PlayMode getPlayMode() const { return _playmode; }
83
84 void setStartTime(double time) { _startTime = time;}
85 double getStartTime() const { return _startTime;}
86
87 protected:
88
90
91 double _duration;
93 float _weight;
94 double _startTime;
97
98 };
99
100 typedef std::vector<osg::ref_ptr<osgAnimation::Animation> > AnimationList;
101 typedef std::map<std::string, osg::ref_ptr<osgAnimation::Animation> > AnimationMap;
102
103
104}
105
106#endif
The osgAnimation library provides general purpose utility classes for animation.
Definition Action:34
std::vector< osg::ref_ptr< osgAnimation::Animation > > AnimationList
Definition Animation:100
std::map< std::string, osg::ref_ptr< osgAnimation::Animation > > AnimationMap
Definition Animation:101
std::vector< osg::ref_ptr< osgAnimation::Channel > > ChannelList
Definition Channel:168
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
Definition Animation:29
PlayMode getPlayMode() const
Definition Animation:82
bool update(double time, int priority=0)
void setStartTime(double time)
Definition Animation:84
double computeDurationFromChannels() const
float getWeight() const
double _duration
Definition Animation:91
double getDuration() const
double _originalDuration
Definition Animation:92
Animation(const osgAnimation::Animation &, const osg::CopyOp &)
void removeChannel(Channel *pChannel)
~Animation()
Definition Animation:89
double getStartTime() const
Definition Animation:85
void addChannel(Channel *pChannel)
const ChannelList & getChannels() const
ChannelList _channels
Definition Animation:96
void setPlayMode(PlayMode mode)
Definition Animation:81
PlayMode _playmode
Definition Animation:95
ChannelList & getChannels()
Those accessors let you add and remove channels if you modify something that can change the duration ...
META_Object(osgAnimation, Animation) Animation()
Definition Animation:31
void setWeight(float weight)
PlayMode
Definition Animation:40
@ STAY
Definition Animation:42
@ PPONG
Definition Animation:44
@ ONCE
Definition Animation:41
@ LOOP
Definition Animation:43
void setDuration(double duration)
Change the duration of animation then evaluate the animation in the range 0-duration it stretch the a...
float _weight
Definition Animation:93
double _startTime
Definition Animation:94
void computeDuration()
Compute duration from channel and keyframes if the duration is not specified you should call this met...
Definition Channel:33
#define OSGANIMATION_EXPORT
Definition Export:40

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.