SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
AnimationBase Class Reference

A base class for all animations. More...

#include <animation_base.hpp>

Inheritance diagram for AnimationBase:
Inheritance graph
[legend]

Public Member Functions

 AnimationBase (const XMLNode &node)
 
 AnimationBase (Ipo *ipo)
 Special constructor which takes one IPO (or curve).
 
virtual void update (float dt, Vec3 *xyz=NULL, Vec3 *hpr=NULL, Vec3 *scale=NULL)
 Updates the time, position and rotation.
 
virtual void getAt (float time, Vec3 *xyz=NULL, Vec3 *hpr=NULL, Vec3 *scale=NULL)
 Return the time, position and rotation at the specified time.
 
virtual void getDerivativeAt (float time, Vec3 *xyz)
 Returns the derivative at the specified point.
 
virtual void update (float dt)
 This needs to be implemented by the inheriting classes.
 
void setInitialTransform (const Vec3 &xyz, const Vec3 &hpr)
 Stores the initial transform (in the IPOs actually).
 
void reset ()
 Resets all IPOs for this animation.
 
void setPlaying (bool playing)
 Disables or enables an animation.
 
float getAnimationDuration () const
 

Protected Attributes

std::vector< Ipo * > m_all_ipos
 All IPOs for this animation.
 
bool m_playing
 True if the animation is currently playing.
 
float m_animation_duration
 
float m_current_time
 The current time used in the IPOs.
 

Private Types

enum  AnimTimeType { ATT_CYCLIC , ATT_CYCLIC_ONCE }
 Two types of animations: cyclic ones that play all the time, and one time only (which might get triggered more than once).
 

Private Member Functions

void calculateAnimationDuration ()
 

Private Attributes

enum AnimationBase::AnimTimeType m_anim_type
 
Vec3 m_initial_xyz
 The inital position of this object.
 
Vec3 m_initial_hpr
 The initial rotation of this object.
 

Detailed Description

A base class for all animations.

Constructor & Destructor Documentation

◆ AnimationBase()

AnimationBase::AnimationBase ( Ipo ipo)

Special constructor which takes one IPO (or curve).

This is used by the

Member Function Documentation

◆ getAt()

void AnimationBase::getAt ( float  time,
Vec3 xyz = NULL,
Vec3 hpr = NULL,
Vec3 scale = NULL 
)
virtual

Return the time, position and rotation at the specified time.

It does not update the internal timer as update() does.

Parameters
dtTime since last call.
xyzPosition to be updated.
hprRotation to be updated.

◆ getDerivativeAt()

void AnimationBase::getDerivativeAt ( float  time,
Vec3 xyz 
)
virtual

Returns the derivative at the specified point.

Parameters
timeThe time for which to determine the derivative.
xyzFloat pointer to store the result.

◆ setInitialTransform()

void AnimationBase::setInitialTransform ( const Vec3 xyz,
const Vec3 hpr 
)

Stores the initial transform (in the IPOs actually).

This is necessary for relative IPOs.

Parameters
xyzPosition of the object.
hprRotation of the object.

◆ update() [1/2]

virtual void AnimationBase::update ( float  dt)
inlinevirtual

This needs to be implemented by the inheriting classes.

It is called once per frame from the track. It has a dummy implementation that just asserts so that this class can be instantiated in CannonAnimation.

Reimplemented in ThreeDAnimation.

◆ update() [2/2]

void AnimationBase::update ( float  dt,
Vec3 xyz = NULL,
Vec3 hpr = NULL,
Vec3 scale = NULL 
)
virtual

Updates the time, position and rotation.

Called once per frame.

Parameters
dtTime since last call.
xyzPosition to be updated.
hprRotation to be updated.

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