OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
WGEAnimationManipulator Class Reference

New OSG manipulator: AnimationManipulator. More...

#include <WGEAnimationManipulator.h>

+ Inheritance diagram for WGEAnimationManipulator:
+ Collaboration diagram for WGEAnimationManipulator:

Public Types

typedef osg::ref_ptr< WGEAnimationManipulatorRefPtr
 Convenience typedef. More...
 
typedef osg::ref_ptr< const WGEAnimationManipulatorConstRefPtr
 Convenience typedef. More...
 

Public Member Functions

 WGEAnimationManipulator (WTimer::ConstSPtr timer=WTimer::ConstSPtr(new WRealtimeTimer()))
 Constructs a animation path manipulator using a realtime timer if not specified. More...
 
virtual ~WGEAnimationManipulator ()
 Destructor. More...
 
virtual void setByMatrix (const osg::Matrixd &matrix)
 Sets the current matrix of this animation manipulator. More...
 
virtual void setByInverseMatrix (const osg::Matrixd &matrix)
 Sets the current inverse matrix of this animation manipulator. More...
 
virtual osg::Matrixd getMatrix () const
 Gets the current animation matrix for the current time-step. More...
 
virtual osg::Matrixd getInverseMatrix () const
 Gets the current inverse animation matrix for the current time-step. More...
 
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
 Handles incoming events send by the event dispatcher of the view. More...
 
virtual void init (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
 Initializes this manipulator. More...
 
virtual void home (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
 Sets the manipulator back to its default. More...
 
virtual void home (double currentTime)
 Sets the animation callback to a certain time. More...
 
virtual void setTimer (WTimer::ConstSPtr timer)
 Allows to switch the timer type. More...
 

Private Member Functions

void handleFrame ()
 This method updates m_matrix per frame according to time elapsed. More...
 

Private Attributes

osg::Matrixd m_matrix
 The view matrix. More...
 
WTimer::ConstSPtr m_timer
 This timer keeps track of the current animation-time. More...
 
double m_homeOffsetTime
 If home() is called, the homeOffsetTime stores the timers current value. More...
 

Detailed Description

New OSG manipulator: AnimationManipulator.

Can play back animation paths (not osg::AnimationPath),

Definition at line 51 of file WGEAnimationManipulator.h.

Member Typedef Documentation

◆ ConstRefPtr

Convenience typedef.

Definition at line 62 of file WGEAnimationManipulator.h.

◆ RefPtr

Convenience typedef.

Definition at line 57 of file WGEAnimationManipulator.h.

Constructor & Destructor Documentation

◆ WGEAnimationManipulator()

WGEAnimationManipulator::WGEAnimationManipulator ( WTimer::ConstSPtr  timer = WTimer::ConstSPtr( new WRealtimeTimer() ))

Constructs a animation path manipulator using a realtime timer if not specified.

Parameters
timerthe timer type

Definition at line 35 of file WGEAnimationManipulator.cpp.

◆ ~WGEAnimationManipulator()

WGEAnimationManipulator::~WGEAnimationManipulator ( )
virtual

Destructor.

Definition at line 43 of file WGEAnimationManipulator.cpp.

Member Function Documentation

◆ getInverseMatrix()

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.

Returns
the matrix

Definition at line 63 of file WGEAnimationManipulator.cpp.

References m_matrix.

◆ getMatrix()

osg::Matrixd WGEAnimationManipulator::getMatrix ( ) const
virtual

Gets the current animation matrix for the current time-step.

Returns
the matrix.

Definition at line 58 of file WGEAnimationManipulator.cpp.

References m_matrix.

◆ handle()

bool WGEAnimationManipulator::handle ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  us 
)
virtual

Handles incoming events send by the event dispatcher of the view.

Parameters
eaevent adapter
usaction adapter allowing interaction with the event dispatcher
Returns
true if the event was handled

Definition at line 68 of file WGEAnimationManipulator.cpp.

References handleFrame().

+ Here is the call graph for this function:

◆ handleFrame()

void WGEAnimationManipulator::handleFrame ( )
private

This method updates m_matrix per frame according to time elapsed.

Definition at line 326 of file WGEAnimationManipulator.cpp.

References Transformation::axeX, Transformation::axeY, Transformation::finish(), m_homeOffsetTime, m_matrix, and m_timer.

Referenced by handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ home() [1/2]

void WGEAnimationManipulator::home ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  us 
)
virtual

Sets the manipulator back to its default.

Parameters
eaevent adapter
usaction adapter allowing interaction with the event dispatcher

Definition at line 92 of file WGEAnimationManipulator.cpp.

Referenced by init(), and setTimer().

+ Here is the caller graph for this function:

◆ home() [2/2]

void WGEAnimationManipulator::home ( double  currentTime)
virtual

Sets the animation callback to a certain time.

Parameters
currentTimethe time to which the manipulator should be set.

Definition at line 97 of file WGEAnimationManipulator.cpp.

References m_homeOffsetTime, and m_timer.

◆ init()

void WGEAnimationManipulator::init ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  us 
)
virtual

Initializes this manipulator.

This simply calls home( 0 ).

Parameters
eaevent adapter
usaction adapter allowing interaction with the event dispatcher

Definition at line 87 of file WGEAnimationManipulator.cpp.

References home().

+ Here is the call graph for this function:

◆ setByInverseMatrix()

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.

Parameters
matrixthe matrix to set

Definition at line 53 of file WGEAnimationManipulator.cpp.

References m_matrix.

◆ setByMatrix()

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.

Parameters
matrixthe matrix to set

Definition at line 48 of file WGEAnimationManipulator.cpp.

References m_matrix.

◆ setTimer()

void WGEAnimationManipulator::setTimer ( WTimer::ConstSPtr  timer)
virtual

Allows to switch the timer type.

It continues animation at the current timer position.

Parameters
timerthe timer

Definition at line 102 of file WGEAnimationManipulator.cpp.

References home(), and m_timer.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_homeOffsetTime

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().

◆ m_matrix

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().

◆ m_timer

WTimer::ConstSPtr WGEAnimationManipulator::m_timer
private

This timer keeps track of the current animation-time.

Definition at line 156 of file WGEAnimationManipulator.h.

Referenced by handleFrame(), home(), and setTimer().


The documentation for this class was generated from the following files: