SuperTuxKart
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). More...
 
virtual void update (float dt, Vec3 *xyz=NULL, Vec3 *hpr=NULL, Vec3 *scale=NULL)
 Updates the time, position and rotation. More...
 
virtual void getAt (float time, Vec3 *xyz=NULL, Vec3 *hpr=NULL, Vec3 *scale=NULL)
 Return the time, position and rotation at the specified time. More...
 
virtual void getDerivativeAt (float time, Vec3 *xyz)
 Returns the derivative at the specified point. More...
 
virtual void update (float dt)
 This needs to be implemented by the inheriting classes. More...
 
void setInitialTransform (const Vec3 &xyz, const Vec3 &hpr)
 Stores the initial transform (in the IPOs actually). More...
 
void reset ()
 Resets all IPOs for this animation.
 
void setPlaying (bool playing)
 Disables or enables an animation. More...
 
float getAnimationDuration () const
 

Protected Attributes

PtrVector< Ipom_all_ipos
 All IPOs for this animation. More...
 
bool m_playing
 True if the animation is currently playing. More...
 
float m_animation_duration
 
float m_current_time
 The current time used in the IPOs. More...
 

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

Private Member Functions

void calculateAnimationDuration ()
 

Private Attributes

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

Detailed Description

A base class for all animations.

Member Enumeration Documentation

◆ AnimTimeType

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

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.

◆ setPlaying()

void AnimationBase::setPlaying ( bool  playing)
inline

Disables or enables an animation.

◆ update() [1/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.

◆ update() [2/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.

Member Data Documentation

◆ m_all_ipos

PtrVector<Ipo> AnimationBase::m_all_ipos
protected

All IPOs for this animation.

◆ m_current_time

float AnimationBase::m_current_time
protected

The current time used in the IPOs.

◆ m_initial_hpr

Vec3 AnimationBase::m_initial_hpr
private

The initial rotation of this object.

◆ m_initial_xyz

Vec3 AnimationBase::m_initial_xyz
private

The inital position of this object.

◆ m_playing

bool AnimationBase::m_playing
protected

True if the animation is currently playing.


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