OpenSceneGraph 3.6.5
AnimationPathManipulator
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGGA_ANIMATION_PATH_MANIPULATOR
15#define OSGGA_ANIMATION_PATH_MANIPULATOR 1
16
17#include <osg/AnimationPath>
18#include <osg/Notify>
20
21namespace osgGA{
22
23//
24// The AnimationPathManipulator is a Matrix Manipulator that reads an
25// animation path from a file and plays it back. The file is expected
26// to be ascii and a succession of lines with 8 floating point values
27// per line. The succession of values are:
28// time px py pz ax ay az aw
29// where:
30// time = elapsed time in seconds from the beginning of the animation
31// px py pz = World position in cartesian coordinates
32// ax ay az aw = Orientation (attitude) defined as a quaternion
33
35{
36 public:
37
39
40 AnimationPathManipulator( const std::string& filename );
41
42 virtual const char* className() const { return "AnimationPath"; }
43
44 void setTimeScale(double s) { _timeScale = s; }
45 double getTimeScale() const { return _timeScale; }
46
47 void setTimeOffset(double o) { _timeOffset = o; }
48 double getTimeOffset() const { return _timeOffset; }
49
51 {
52 virtual void completed(const AnimationPathManipulator* apm) = 0;
53 };
54
58
59 void setPrintOutTimingInfo(bool printOutTimingInfo) { _printOutTimingInfo=printOutTimingInfo; }
61
63 virtual void setByMatrix(const osg::Matrixd& matrix) { _matrix = matrix; }
64
66 virtual void setByInverseMatrix(const osg::Matrixd& matrix) { _matrix.invert(matrix); }
67
69 virtual osg::Matrixd getMatrix() const { return _matrix; }
70
73
74
75 void setAnimationPath( osg::AnimationPath* animationPath ) { _animationPath=animationPath; }
76
78
79 const osg::AnimationPath* getAnimationPath() const { return _animationPath.get(); }
80
81 bool valid() const { return _animationPath.valid(); }
82
84
86 void home(double currentTime);
87
88 virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
89
91 virtual void getUsage(osg::ApplicationUsage& usage) const;
92
93 protected:
94
95 bool _valid;
96
98
99 void handleFrame( double time );
100
102
105
107
110
114
116
117};
118
119}
120
121#endif
The 'GA' in osgGA stands for 'GUI Abstraction'; the osgGA namespace provides facilities to help devel...
Definition Callback:21
AnimationPath encapsulates a time varying transformation pathway.
Definition AnimationPath:34
Definition ApplicationUsage:26
Definition Matrixd:27
static Matrixd inverse(const Matrixd &matrix)
Definition Matrixd:536
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Base class for providing reference counted objects.
Definition Referenced:44
bool valid() const
Definition AnimationPathManipulator:81
void setTimeOffset(double o)
Definition AnimationPathManipulator:47
AnimationPathManipulator(const std::string &filename)
osg::Matrixd _matrix
Definition AnimationPathManipulator:115
void setAnimationPath(osg::AnimationPath *animationPath)
Definition AnimationPathManipulator:75
AnimationCompletedCallback * getAnimationCompletedCallback()
Definition AnimationPathManipulator:56
void home(const GUIEventAdapter &ea, GUIActionAdapter &us)
Move the camera to the default position.
double _timeScale
Definition AnimationPathManipulator:104
double getTimeOffset() const
Definition AnimationPathManipulator:48
virtual const char * className() const
return the name of the object's class type.
Definition AnimationPathManipulator:42
osg::ref_ptr< osg::AnimationPath > _animationPath
Definition AnimationPathManipulator:101
void setPrintOutTimingInfo(bool printOutTimingInfo)
Definition AnimationPathManipulator:59
double _pauseTime
Definition AnimationPathManipulator:108
bool _valid
Definition AnimationPathManipulator:95
double _realStartOfTimedPeriod
Definition AnimationPathManipulator:111
AnimationPathManipulator(osg::AnimationPath *animationPath=0)
bool getPrintOutTimingInfo() const
Definition AnimationPathManipulator:60
void setTimeScale(double s)
Definition AnimationPathManipulator:44
virtual bool handle(const GUIEventAdapter &ea, GUIActionAdapter &us)
Handle events, return true if handled, false otherwise.
const AnimationCompletedCallback * getAnimationCompletedCallback() const
Definition AnimationPathManipulator:57
bool _printOutTimingInfo
Definition AnimationPathManipulator:97
double getTimeScale() const
Definition AnimationPathManipulator:45
void setAnimationCompletedCallback(AnimationCompletedCallback *acc)
Definition AnimationPathManipulator:55
double _timeOffset
Definition AnimationPathManipulator:103
virtual void setByInverseMatrix(const osg::Matrixd &matrix)
set the position of the matrix manipulator using a 4x4 Matrix.
Definition AnimationPathManipulator:66
bool _isPaused
Definition AnimationPathManipulator:109
osg::ref_ptr< AnimationCompletedCallback > _animationCompletedCallback
Definition AnimationPathManipulator:106
void home(double currentTime)
Move the camera to the default position.
virtual void getUsage(osg::ApplicationUsage &usage) const
Get the keyboard and mouse usage of this manipulator.
virtual void setByMatrix(const osg::Matrixd &matrix)
set the position of the matrix manipulator using a 4x4 Matrix.
Definition AnimationPathManipulator:63
osg::AnimationPath * getAnimationPath()
Definition AnimationPathManipulator:77
const osg::AnimationPath * getAnimationPath() const
Definition AnimationPathManipulator:79
double _animStartOfTimedPeriod
Definition AnimationPathManipulator:112
virtual osg::Matrixd getInverseMatrix() const
get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model...
Definition AnimationPathManipulator:72
virtual osg::Matrixd getMatrix() const
get the position of the manipulator as 4x4 Matrix.
Definition AnimationPathManipulator:69
void init(const GUIEventAdapter &ea, GUIActionAdapter &us)
Start/restart the manipulator.
int _numOfFramesSinceStartOfTimedPeriod
Definition AnimationPathManipulator:113
virtual void completed(const AnimationPathManipulator *apm)=0
Definition GUIActionAdapter:62
Event class for storing Keyboard, mouse and window events.
Definition GUIEventAdapter:82
#define OSGGA_EXPORT
Definition Export:40

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