OpenWalnut
1.4.0
|
New OSG manipulator: AnimationManipulator. More...
#include <WGEAnimationManipulator.h>
Public Types | |
typedef osg::ref_ptr < WGEAnimationManipulator > | RefPtr |
Convenience typedef. | |
typedef osg::ref_ptr< const WGEAnimationManipulator > | ConstRefPtr |
Convenience typedef. | |
Public Member Functions | |
WGEAnimationManipulator (WTimer::ConstSPtr timer=WTimer::ConstSPtr(new WRealtimeTimer())) | |
Constructs a animation path manipulator using a realtime timer if not specified. | |
virtual | ~WGEAnimationManipulator () |
Destructor. | |
virtual void | setByMatrix (const osg::Matrixd &matrix) |
Sets the current matrix of this animation manipulator. | |
virtual void | setByInverseMatrix (const osg::Matrixd &matrix) |
Sets the current inverse matrix of this animation manipulator. | |
virtual osg::Matrixd | getMatrix () const |
Gets the current animation matrix for the current time-step. | |
virtual osg::Matrixd | getInverseMatrix () const |
Gets the current inverse animation matrix for the current time-step. | |
virtual bool | handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us) |
Handles incoming events send by the event dispatcher of the view. | |
virtual void | init (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us) |
Initializes this manipulator. | |
virtual void | home (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us) |
Sets the manipulator back to its default. | |
virtual void | home (double currentTime) |
Sets the animation callback to a certain time. | |
virtual void | setTimer (WTimer::ConstSPtr timer) |
Allows to switch the timer type. | |
Private Member Functions | |
void | handleFrame () |
This method updates m_matrix per frame according to time elapsed. | |
Private Attributes | |
osg::Matrixd | m_matrix |
The view matrix. | |
WTimer::ConstSPtr | m_timer |
This timer keeps track of the current animation-time. | |
double | m_homeOffsetTime |
If home() is called, the homeOffsetTime stores the timers current value. | |
bool | m_paused |
If true, the animation is suspended. |
New OSG manipulator: AnimationManipulator.
Can play back animation paths (not osg::AnimationPath),
Definition at line 51 of file WGEAnimationManipulator.h.
typedef osg::ref_ptr< const WGEAnimationManipulator > WGEAnimationManipulator::ConstRefPtr |
Convenience typedef.
Definition at line 62 of file WGEAnimationManipulator.h.
typedef osg::ref_ptr< WGEAnimationManipulator > WGEAnimationManipulator::RefPtr |
Convenience typedef.
Definition at line 57 of file WGEAnimationManipulator.h.
WGEAnimationManipulator::WGEAnimationManipulator | ( | WTimer::ConstSPtr | timer = WTimer::ConstSPtr( new WRealtimeTimer() ) | ) |
Constructs a animation path manipulator using a realtime timer if not specified.
timer | the timer type |
Definition at line 35 of file WGEAnimationManipulator.cpp.
WGEAnimationManipulator::~WGEAnimationManipulator | ( | ) | [virtual] |
Destructor.
Definition at line 44 of file WGEAnimationManipulator.cpp.
osg::Matrixd WGEAnimationManipulator::getInverseMatrix | ( | ) | const [virtual] |
Gets the current inverse animation matrix for the current time-step.
In most cases, this should be used as modelview matrix.
Definition at line 64 of file WGEAnimationManipulator.cpp.
References m_matrix.
osg::Matrixd WGEAnimationManipulator::getMatrix | ( | ) | const [virtual] |
Gets the current animation matrix for the current time-step.
Definition at line 59 of file WGEAnimationManipulator.cpp.
References m_matrix.
bool WGEAnimationManipulator::handle | ( | const osgGA::GUIEventAdapter & | ea, |
osgGA::GUIActionAdapter & | us | ||
) | [virtual] |
Handles incoming events send by the event dispatcher of the view.
ea | event adapter |
us | action adapter allowing interaction with the event dispatcher |
Definition at line 69 of file WGEAnimationManipulator.cpp.
References handleFrame().
void WGEAnimationManipulator::handleFrame | ( | ) | [private] |
This method updates m_matrix per frame according to time elapsed.
Definition at line 329 of file WGEAnimationManipulator.cpp.
References Transformation::finish(), m_homeOffsetTime, m_matrix, and m_timer.
Referenced by handle().
void WGEAnimationManipulator::home | ( | const osgGA::GUIEventAdapter & | ea, |
osgGA::GUIActionAdapter & | us | ||
) | [virtual] |
Sets the manipulator back to its default.
ea | event adapter |
us | action adapter allowing interaction with the event dispatcher |
Definition at line 93 of file WGEAnimationManipulator.cpp.
Referenced by init(), and setTimer().
void WGEAnimationManipulator::home | ( | double | currentTime | ) | [virtual] |
Sets the animation callback to a certain time.
currentTime | the time to which the manipulator should be set. |
Definition at line 98 of file WGEAnimationManipulator.cpp.
References m_homeOffsetTime, and m_timer.
void WGEAnimationManipulator::init | ( | const osgGA::GUIEventAdapter & | ea, |
osgGA::GUIActionAdapter & | us | ||
) | [virtual] |
Initializes this manipulator.
This simply calls home( 0 ).
ea | event adapter |
us | action adapter allowing interaction with the event dispatcher |
Definition at line 88 of file WGEAnimationManipulator.cpp.
References home().
void WGEAnimationManipulator::setByInverseMatrix | ( | const osg::Matrixd & | matrix | ) | [virtual] |
Sets the current inverse matrix of this animation manipulator.
This is, in most cases, the modelview matrix. This most probably gets overwritten in the next frame by the current animation matrix.
matrix | the matrix to set |
Definition at line 54 of file WGEAnimationManipulator.cpp.
References m_matrix.
void WGEAnimationManipulator::setByMatrix | ( | const osg::Matrixd & | matrix | ) | [virtual] |
Sets the current matrix of this animation manipulator.
This most probably gets overwritten in the next frame by the current animation matrix.
matrix | the matrix to set |
Definition at line 49 of file WGEAnimationManipulator.cpp.
References m_matrix.
void WGEAnimationManipulator::setTimer | ( | WTimer::ConstSPtr | timer | ) | [virtual] |
Allows to switch the timer type.
It continues animation at the current timer position.
timer | the timer |
Definition at line 103 of file WGEAnimationManipulator.cpp.
double WGEAnimationManipulator::m_homeOffsetTime [private] |
If home() is called, the homeOffsetTime stores the timers current value.
Definition at line 161 of file WGEAnimationManipulator.h.
Referenced by handleFrame(), and home().
osg::Matrixd WGEAnimationManipulator::m_matrix [private] |
The view matrix.
Gets modified on a per-frame basis.
Definition at line 151 of file WGEAnimationManipulator.h.
Referenced by getInverseMatrix(), getMatrix(), handleFrame(), setByInverseMatrix(), and setByMatrix().
bool WGEAnimationManipulator::m_paused [private] |
If true, the animation is suspended.
Definition at line 171 of file WGEAnimationManipulator.h.
This timer keeps track of the current animation-time.
Definition at line 156 of file WGEAnimationManipulator.h.
Referenced by handleFrame(), home(), and setTimer().