SuperTuxKart
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
Ipo Class Reference

A class to manage a single blender IPO curve. More...

#include <ipo.hpp>

Inheritance diagram for Ipo:
Inheritance graph
[legend]

Classes

class  IpoData
 This object stores the read-only data of an IPO. More...
 

Public Types

enum  IpoChannelType {
  IPO_LOCX , IPO_LOCY , IPO_LOCZ , IPO_LOCXYZ ,
  IPO_ROTX , IPO_ROTY , IPO_ROTZ , IPO_SCALEX ,
  IPO_SCALEY , IPO_SCALEZ , IPO_MAX
}
 All supported ipo types. More...
 

Public Member Functions

 Ipo (const XMLNode &curve, float fps=25, bool reverse=false)
 The Ipo constructor.
 
virtual ~Ipo ()
 The destructor only frees IpoData if it was created by this instance (and not if this instance was copied, therefore sharing the IpoData).
 
Ipoclone ()
 Creates a copy of this object (the copy constructor is disabled in order to avoid implicit copies happening).
 
void update (float time, Vec3 *xyz=NULL, Vec3 *hpr=NULL, Vec3 *scale=NULL)
 Updates the time of this ipo and interpolates the new position and rotation (taking the cycle length etc.
 
void getDerivative (float time, Vec3 *xyz)
 Returns the derivative for any location based curves.
 
float get (float time, unsigned int index) const
 Returns the interpolated value at the current time (which this objects keeps track of).
 
void setInitialTransform (const Vec3 &xyz, const Vec3 &hpr)
 Stores the initial transform.
 
void reset ()
 Resets the IPO for (re)starting an animation.
 
const std::vector< Vec3 > & getPoints () const
 Returns the raw data points for this IPO.
 
float getEndTime () const
 Returns the last specified time (i.e.
 

Static Public Attributes

static const std::string m_all_channel_names [IPO_MAX]
 

Private Member Functions

void updateNextN (float *time) const
 Updates the value of m_next_n to point to the right ipo segment based on the time.
 
 Ipo (const Ipo *ipo)
 A copy constructor.
 

Private Attributes

IpoDatam_ipo_data
 The actual data of the IPO.
 
bool m_own_ipo_data
 True if m_ipo_data is 'owned' by this object and therefore needs to be freed.
 
unsigned int m_next_n
 Which control points will be the next one (so m_next_n-1 and m_next_n are the control points to use now).
 

Detailed Description

A class to manage a single blender IPO curve.

Member Enumeration Documentation

◆ IpoChannelType

All supported ipo types.

LOCXYZ is basically a curve, the IPO is actually a 3d curve, without a time axis, only the actual data points.

Constructor & Destructor Documentation

◆ Ipo() [1/2]

Ipo::Ipo ( const Ipo ipo)
private

A copy constructor.

It shares the read-only data with the source Ipo

Parameters
ipoThe ipo to copy from.

◆ Ipo() [2/2]

Ipo::Ipo ( const XMLNode curve,
float  fps = 25,
bool  reverse = false 
)

The Ipo constructor.

Ipos can share the actual data to interpolate, which is stored in a separate IpoData object, see Ipo(const Ipo *ipo) constructor. This is used for cannons: the actual check line stores the 'master' Ipo, and each actual IPO that animate a kart just use a copy of this read-only data.

Parameters
curveThe XML data for this curve.
fpsFrames per second, used to convert all frame based value in the xml file into seconds.
reverseIf this is set to true, the ipo data will be reverse. This is used by the cannon if the track is driven in reverse.

Member Function Documentation

◆ get()

float Ipo::get ( float  time,
unsigned int  index 
) const

Returns the interpolated value at the current time (which this objects keeps track of).

Parameters
timeThe time for which the interpolated value should be computed.

◆ getDerivative()

void Ipo::getDerivative ( float  time,
Vec3 xyz 
)

Returns the derivative for any location based curves.

Parameters
timeTime for which the derivative is being computed.
xyzPointer where the results should be stored.

◆ getEndTime()

float Ipo::getEndTime ( ) const
inline

Returns the last specified time (i.e.

not considering any extend types).

◆ setInitialTransform()

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

Stores the initial transform.

This is necessary for relative IPOs.

Parameters
xyzPosition of the object.
hprRotation of the object.

◆ update()

void Ipo::update ( float  time,
Vec3 xyz = NULL,
Vec3 hpr = NULL,
Vec3 scale = NULL 
)

Updates the time of this ipo and interpolates the new position and rotation (taking the cycle length etc.

into account). If a NULL is given, the value is not updated.

Parameters
timeCurrent time for which to determine the interpolation.
xyzThe position that needs to be updated (can be NULL).
hprThe rotation that needs to be updated (can be NULL).
scaleThe scale that needs to be updated (can be NULL)

◆ updateNextN()

void Ipo::updateNextN ( float *  time) const
private

Updates the value of m_next_n to point to the right ipo segment based on the time.

Parameters
tTime for which m_next_n needs to be updated.

Member Data Documentation

◆ m_all_channel_names

const std::string Ipo::m_all_channel_names
static
Initial value:
=
{"LocX", "LocY", "LocZ", "LocXYZ",
"RotX", "RotY", "RotZ",
"ScaleX", "ScaleY", "ScaleZ" }

◆ m_ipo_data

IpoData* Ipo::m_ipo_data
private

The actual data of the IPO.

This can be shared between Ipo (e.g. each cannon animation will use the same IpoData block, but its own instance of Ipo, since data like m_next_n should not be shared).

◆ m_next_n

unsigned int Ipo::m_next_n
mutableprivate

Which control points will be the next one (so m_next_n-1 and m_next_n are the control points to use now).

This just reduces lookup time in get(t). To allow modifying this in get() const, it is declared mutable).

◆ m_own_ipo_data

bool Ipo::m_own_ipo_data
private

True if m_ipo_data is 'owned' by this object and therefore needs to be freed.

If an Ipo is cloned, it will share a reference to m_ipo_data, and must therefore not free it.


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