class RED::AnimationClip
Atomic class to store animation key frames. More...
#include <REDAnimationClip.h>
Inherits: Object.
Public functions:
AnimationClip ( ) | |
~AnimationClip ( ) | |
RED_RC | AddKey ( const RED::AnimationData & iKeyData, double iTime, unsigned int iChannel = 0 ) |
virtual void * | As ( const RED::CID & iCID ) |
template< class T_As > const T_As * | As ( ) const |
virtual const void * | As ( const RED::CID & iCID ) const |
template< class T_As > T_As * | As ( ) |
RED_RC | CreateChannels ( unsigned int iChannelsCount ) |
unsigned int | GetChannelsCount ( ) const |
double | GetDuration ( ) const |
RED_RC | GetKeyData ( const RED::AnimationData *& oData, unsigned int iKey, unsigned int iChannel = 0 ) const |
RED_RC | GetKeysCount ( unsigned int & oKeysCount, unsigned int iChannel = 0 ) const |
RED_RC | GetKeyTime ( double & oTime, unsigned int iKey, unsigned int iChannel = 0 ) const |
RED_RC | Interpolate ( RED::Vector< RED::AnimationData > & oOutput, double iTime ) const |
RED_RC | InterpolateChannel ( RED::AnimationData & oOutput, unsigned int iChannel, double iTime ) const |
Public static functions:
static RED::CID | GetClassID ( ) |
Protected classes:
struct | AnimationChannel |
struct | AnimationKey |
Protected functions:
RED_RC | GetSurroundingKeys ( const AnimationKey *& oKeyBefore, const AnimationKey *& oKeyAfter, unsigned int iChannel, double iTime ) const |
Protected variables:
RED::Vector< AnimationChannel > | _channels |
double | _duration |
Detailed description:
Atomic class to store animation key frames.
An animation clip contains one or more animation channels.
Each animation channel stored the sequence of animation key frames.
A key frame is composed of an animation data (RED::AnimationData) associated with a timestamp in the channel.
The AnimationClip class also provides query methods to get the interpolated data at a given time in the animation clip.
Functions documentation
public RED::AnimationClip::AnimationClip | ( | ) |
Constructor.
public RED::AnimationClip::~AnimationClip | ( | ) |
Destructor.
public static RED::CID RED::AnimationClip::GetClassID | ( | ) |
Reimplements: RED::Object::GetClassID.
public RED_RC RED::AnimationClip::AddKey | ( | const RED::AnimationData & | iKeyData, |
double | iTime, | ||
unsigned int | iChannel = 0 | ||
) |
Adds an animation key in a given channel at a given time.
Channels must have been created with RED::AnimationClip::CreateChannels before calling this function.
Note:
Important: keys must be added in the correct order from time 0 to end of animation in each channel. If not, the function will return RED_BAD_PARAM. The channel order is not important.
Parameters:
iKeyData: | The animation key data to add. |
iTime: | Time of the animation key in the channel. |
iChannel: | Channel to add the key. |
Returns:
RED_BAD_PARAM if channel has not been created or if keys are not added in the correct order,
RED_FAIL otherwise.
public virtual void * RED::AnimationClip::As | ( | const RED::CID & | iCID | ) |
Converts the object to an instance of the given type.
Parameters:
iCID: | Requested class. |
Returns:
Reimplements: RED::Object::As.
template< class T_As > public const T_As * RED::AnimationClip::As | ( | ) const |
Template version of the as const method.
Simply set T to be the class you want to retrieve an interface to.
Returns:
Reimplements: RED::Object::As.
public virtual const void * RED::AnimationClip::As | ( | const RED::CID & | iCID | ) const |
Converts the object to an instance of the given type.
Parameters:
iCID: | Requested class. |
Returns:
Reimplements: RED::Object::As.
template< class T_As > public T_As * RED::AnimationClip::As | ( | ) |
Template version of the as method.
Simply set T to be the class you want to retrieve an interface to.
Returns:
Reimplements: RED::Object::As.
public RED_RC RED::AnimationClip::CreateChannels | ( | unsigned int | iChannelsCount | ) |
public unsigned int RED::AnimationClip::GetChannelsCount | ( | ) const |
Gets the number of channels in the animation clip.
Returns:
public double RED::AnimationClip::GetDuration | ( | ) const |
Gets the animation clip duration.
Returns:
public RED_RC RED::AnimationClip::GetKeyData | ( | const RED::AnimationData *& | oData, |
unsigned int | iKey, | ||
unsigned int | iChannel = 0 | ||
) | const |
Gets the data associated to a key in the animation channel.
Parameters:
oData: | Returned key data. |
iKey: | Key index. |
iChannel: | Channel index. |
Returns:
RED_BAD_PARAM if the channel or key index is incorrect. RED_FAIL otherwise.
public RED_RC RED::AnimationClip::GetKeysCount | ( | unsigned int & | oKeysCount, |
unsigned int | iChannel = 0 | ||
) | const |
Gets the number of keys in the animation channel.
Parameters:
oKeysCount: | Returned number of animation keys. |
iChannel: | Channel index. |
Returns:
RED_BAD_PARAM if the channel index is incorrect. RED_FAIL otherwise.
public RED_RC RED::AnimationClip::GetKeyTime | ( | double & | oTime, |
unsigned int | iKey, | ||
unsigned int | iChannel = 0 | ||
) | const |
Gets the time associated to a key in the animation channel.
Parameters:
oTime: | Returned key time. |
iKey: | Key index. |
iChannel: | Channel index. |
Returns:
RED_BAD_PARAM if the channel or key index is incorrect. RED_FAIL otherwise.
public RED_RC RED::AnimationClip::Interpolate | ( | RED::Vector< RED::AnimationData > & | oOutput, |
double | iTime | ||
) | const |
public RED_RC RED::AnimationClip::InterpolateChannel | ( | RED::AnimationData & | oOutput, |
unsigned int | iChannel, | ||
double | iTime | ||
) | const |
protected RED_RC RED::AnimationClip::GetSurroundingKeys | ( | const AnimationKey *& | oKeyBefore, |
const AnimationKey *& | oKeyAfter, | ||
unsigned int | iChannel, | ||
double | iTime | ||
) | const |
Returns the animation keys before and after a given time in a given channel.
Parameters:
oKeyBefore: | Returned animation key before iTime. |
oKeyAfter: | Returned animation key after iTime. |
iChannel: | Channel to get the keys. |
iTime: | Time to get the keys before and after. |
Returns:
Variables documentation
_channels: list of animation channels in the clip.
_duration: total duration of the animation clip.