- Cal3D 0.11 API Reference -

Public Member Functions | Protected Attributes | List of all members
CalMixer Class Reference
Inheritance diagram for CalMixer:
CalAbstractMixer

Public Member Functions

 CalMixer (CalModel *pModel)
 Constructs the mixer instance. More...
 
virtual ~CalMixer ()
 Destructs the mixer instance. More...
 
virtual bool isDefaultMixer () const
 Is the object an instance of the default mixer (i.e. More...
 
bool blendCycle (int id, float weight, float delay)
 Interpolates the weight of an animation cycle. More...
 
bool clearCycle (int id, float delay)
 Fades an animation cycle out. More...
 
bool executeAction (int id, float delayIn, float delayOut, float weightTarget=1.0f, bool autoLock=false)
 Executes an animation action. More...
 
bool removeAction (int id)
 Clears an active animation action. More...
 
virtual void updateAnimation (float deltaTime)
 Updates all active animations. More...
 
virtual void updateSkeleton ()
 Updates the skeleton of the corresponding CalModel (as provided to the create method) to match the current animation state (as updated by the last call to updateAnimation). More...
 
float getAnimationTime () const
 Returns the animation time. More...
 
float getAnimationDuration () const
 Returns the animation duration. More...
 
void setAnimationTime (float animationTime)
 Sets the animation time. More...
 
void setTimeFactor (float timeFactor)
 Set the time factor. More...
 
float getTimeFactor () const
 Get the time factor. More...
 
CalModelgetCalModel ()
 Get the model. More...
 
const CalModelgetCalModel () const
 Get the model. More...
 
std::vector< CalAnimation * > & getAnimationVector ()
 Get the animation vector. More...
 
const std::vector< CalAnimation * > & getAnimationVector () const
 Get the animation vector. More...
 
std::list< CalAnimationAction * > & getAnimationActionList ()
 Get the list of the action animation. More...
 
const std::list< CalAnimationAction * > & getAnimationActionList () const
 Get the list of the action animation. More...
 
std::list< CalAnimationCycle * > & getAnimationCycle ()
 Get the list of the cycle animation. More...
 
const std::list< CalAnimationCycle * > & getAnimationCycle () const
 Get the list of the cycle animation. More...
 
bool actionOn (int coreAnimationId)
 Is action playing? More...
 
bool stopAction (int coreAnimationId)
 Stop the action. More...
 
bool addManualAnimation (int coreAnimationId)
 Add a manual animation instance. More...
 
bool removeManualAnimation (int coreAnimationId)
 Remove a manual animation instance. More...
 
bool setManualAnimationOn (int coreAnimationId, bool)
 Sets the manual animation on or off. More...
 
bool setManualAnimationTime (int coreAnimationId, float seconds)
 Sets the time of the manual animation. More...
 
bool setManualAnimationWeight (int coreAnimationId, float)
 Sets the weight of the manual animation. More...
 
bool setManualAnimationScale (int coreAnimationId, float p)
 Sets the scale of the manual animation to 0-1. More...
 
bool setManualAnimationRampValue (int coreAnimationId, float p)
 Sets the RampValue of the manual animation to 0-1. More...
 
bool setManualAnimationCompositionFunction (int coreAnimationId, CalAnimation::CompositionFunction p)
 Sets the composition function, which controls how animation blends with other simultaneous animations. More...
 
bool setManualAnimationAttributes (int coreAnimationId, CalMixerManualAnimationAttributes const &p)
 Sets all the manual animation attributes. More...
 
bool animationDuration (int coreAnimationId, float *result)
 Return duration of the core animation in seconds. More...
 
bool addBoneAdjustment (int boneId, CalMixerBoneAdjustment const &)
 
bool removeBoneAdjustment (int boneId)
 
void removeAllBoneAdjustments ()
 
unsigned int numActiveOneShotAnimations ()
 
CalAnimationActionanimationActionFromCoreAnimationId (int coreAnimationId)
 This function returns CalAnimationAction for given coreAnimationId. More...
 
CalAnimationActionnewAnimationAction (int coreAnimationId)
 
bool setManualAnimationCompositionFunction (CalAnimationAction *, CalAnimation::CompositionFunction p)
 
bool setManualAnimationRampValue (CalAnimationAction *, float p)
 
bool setManualAnimationScale (CalAnimationAction *, float p)
 
bool setManualAnimationWeight (CalAnimationAction *, float p)
 
bool setManualAnimationTime (CalAnimationAction *, float p)
 
bool setManualAnimationOn (CalAnimationAction *, bool p)
 
void applyBoneAdjustments ()
 

Protected Attributes

CalModelm_pModel
 
std::vector< CalAnimation * > m_vectorAnimation
 
std::list< CalAnimationAction * > m_listAnimationAction
 
std::list< CalAnimationCycle * > m_listAnimationCycle
 
float m_animationTime
 
float m_animationDuration
 
float m_timeFactor
 
unsigned int m_numBoneAdjustments
 
CalMixerBoneAdjustmentAndBoneId m_boneAdjustmentAndBoneIdArray [CalMixerBoneAdjustmentsMax]
 

Constructor & Destructor Documentation

◆ CalMixer()

CalMixer::CalMixer ( CalModel pModel)

Constructs the mixer instance.

This function is the default constructor of the mixer instance.

◆ ~CalMixer()

CalMixer::~CalMixer ( )
virtual

Destructs the mixer instance.

This function is the destructor of the mixer instance.

Member Function Documentation

◆ actionOn()

bool CalMixer::actionOn ( int  coreAnimationId)

Is action playing?

Actions turn off automatically so you might need to know if one is playing.

Parameters
idThe ID of the core animation.
Returns
One of the following values:
  • true if playing
  • false if not

◆ addManualAnimation()

bool CalMixer::addManualAnimation ( int  coreAnimationId)

Add a manual animation instance.

Add a manual animation instance for this core animation if one does not already exist. Only one instance can exist per core animation. A manual animation instance can be on or off while still existing. If it is off, it retains its state (time, amplitude), but doesn't have any effect on the skeleton.

Parameters
idThe ID of the core animation.
Returns
One of the following values:
  • true if didn't already exist
  • false if already existed or allocation failed

◆ animationActionFromCoreAnimationId()

CalAnimationAction * CalMixer::animationActionFromCoreAnimationId ( int  coreAnimationId)

This function returns CalAnimationAction for given coreAnimationId.

This function returns CalAnimationAction for given coreAnimationId.

Parameters
idThe ID of the core animation.
Returns
One of the following values:
  • NULL if no action exists for given coreAnimationId.
  • pointer to CalAnimationAction for the given coreAnimationId.

◆ animationDuration()

bool CalMixer::animationDuration ( int  coreAnimationId,
float *  result 
)

Return duration of the core animation in seconds.

Return duration of the core animation in seconds. The duration goes from the time of the first to the last frame. Thus if frames were 1/30 of a second long and there were 31 frames, the duration would be one second. An instance does not have to exist.

Result = duration in seconds.

Returns
One of the following values:
  • true if exists
  • false otherwise

◆ blendCycle()

bool CalMixer::blendCycle ( int  id,
float  weight,
float  delay 
)

Interpolates the weight of an animation cycle.

This function interpolates the weight of an animation cycle to a new value in a given amount of time. If the specified animation cycle is not active yet, it is activated.

Parameters
idThe ID of the animation cycle that should be blended.
weightThe weight to interpolate the animation cycle to.
delayThe time in seconds until the new weight should be reached.
Returns
One of the following values:
  • true if successful
  • false if an error happened

◆ clearCycle()

bool CalMixer::clearCycle ( int  id,
float  delay 
)

Fades an animation cycle out.

This function fades an animation cycle out in a given amount of time.

Parameters
idThe ID of the animation cycle that should be faded out.
delayThe time in seconds until the the animation cycle is completely removed.
Returns
One of the following values:
  • true if successful
  • false if an error happened

◆ executeAction()

bool CalMixer::executeAction ( int  id,
float  delayIn,
float  delayOut,
float  weightTarget = 1.0f,
bool  autoLock = false 
)

Executes an animation action.

This function executes an animation action.

Parameters
idThe ID of the animation action that should be blended.
delayInThe time in seconds until the animation action reaches the full weight from the beginning of its execution.
delayOutThe time in seconds in which the animation action reaches zero weight at the end of its execution.
weightTargetThe weight to interpolate the animation action to.
autoLockThis prevents the Action from being reset and removed on the last keyframe if true.
Returns
One of the following values:
  • true if successful
  • false if an error happened

◆ getAnimationActionList() [1/2]

std::list< CalAnimationAction * > & CalMixer::getAnimationActionList ( )

Get the list of the action animation.

This function return the list of the action animation of the mixer instance.

◆ getAnimationActionList() [2/2]

const std::list< CalAnimationAction * > & CalMixer::getAnimationActionList ( ) const

Get the list of the action animation.

This function return the list of the action animation of the mixer instance.

◆ getAnimationCycle() [1/2]

std::list< CalAnimationCycle * > & CalMixer::getAnimationCycle ( )

Get the list of the cycle animation.

This function return the list of the cycle animation of the mixer instance.

◆ getAnimationCycle() [2/2]

const std::list< CalAnimationCycle * > & CalMixer::getAnimationCycle ( ) const

Get the list of the cycle animation.

This function return the list of the cycle animation of the mixer instance.

◆ getAnimationDuration()

float CalMixer::getAnimationDuration ( ) const

Returns the animation duration.

This function returns the animation duration of the mixer instance.

Returns
The animation duration in seconds.

◆ getAnimationTime()

float CalMixer::getAnimationTime ( ) const

Returns the animation time.

This function returns the animation time of the mixer instance.

Returns
The animation time in seconds.

◆ getAnimationVector() [1/2]

std::vector< CalAnimation * > & CalMixer::getAnimationVector ( )

Get the animation vector.

This function return the animation vector of the mixer instance.

◆ getAnimationVector() [2/2]

const std::vector< CalAnimation * > & CalMixer::getAnimationVector ( ) const

Get the animation vector.

This function return the animation vector of the mixer instance.

◆ getCalModel() [1/2]

CalModel * CalMixer::getCalModel ( )

Get the model.

This function return the CalModel of the mixer instance.

◆ getCalModel() [2/2]

const CalModel * CalMixer::getCalModel ( ) const

Get the model.

This function return the CalModel of the mixer instance.

◆ getTimeFactor()

float CalMixer::getTimeFactor ( ) const

Get the time factor.

This function return the time factor of the mixer instance.

◆ isDefaultMixer()

virtual bool CalMixer::isDefaultMixer ( ) const
inlinevirtual

Is the object an instance of the default mixer (i.e.

an instance of CalMixer) ?

Returns

Reimplemented from CalAbstractMixer.

◆ removeAction()

bool CalMixer::removeAction ( int  id)

Clears an active animation action.

This function removes an animation action from the blend list. This is particularly useful with auto-locked actions on their last frame.

Parameters
idThe ID of the animation action that should be removed.
Returns
One of the following values:
  • true if successful
  • false if an error happened or action was not found

◆ removeManualAnimation()

bool CalMixer::removeManualAnimation ( int  coreAnimationId)

Remove a manual animation instance.

Remove a manual animation instance for this core animation if one already exists.

Parameters
idThe ID of the core animation.
Returns
One of the following values:
  • true if already exist
  • false if didn't exist

◆ setAnimationTime()

void CalMixer::setAnimationTime ( float  animationTime)

Sets the animation time.

This function sets the animation time of the mixer instance.

◆ setManualAnimationAttributes()

bool CalMixer::setManualAnimationAttributes ( int  coreAnimationId,
CalMixerManualAnimationAttributes const &  p 
)

Sets all the manual animation attributes.

Sets all the manual animation attributes. Action must already be manual.

Returns
One of the following values:
  • true if exists and manual
  • false otherwise

◆ setManualAnimationCompositionFunction()

bool CalMixer::setManualAnimationCompositionFunction ( int  coreAnimationId,
CalAnimation::CompositionFunction  p 
)

Sets the composition function, which controls how animation blends with other simultaneous animations.

If you set it to Replace, then when the animation is fully ramped on, all non-Replace and lower priority Replace animations will have zero influence. This factor does not apply to cycling animations. The priority of animations is, firstly whether they are Replace or not, and secondly how recently the animations were added, the most recently added animations having higher priority.

Returns
One of the following values:
  • true if not setting to CompositionFunctionNull
  • false if setting to CompositionFunctionNull, or if action with id doesn't exist.

◆ setManualAnimationOn()

bool CalMixer::setManualAnimationOn ( int  coreAnimationId,
bool  p 
)

Sets the manual animation on or off.

If off, has no effect but retains

Sets the manual animation on or off. If off, has no effect but retains state.

Returns
One of the following values:
  • true if exists and manual
  • false otherwise

◆ setManualAnimationRampValue()

bool CalMixer::setManualAnimationRampValue ( int  coreAnimationId,
float  p 
)

Sets the RampValue of the manual animation to 0-1.

Sets the RampValue of the manual animation. It is an error to call this function for an animation that is not manual.

Returns
One of the following values:
  • true if manual
  • false if not manual

◆ setManualAnimationScale()

bool CalMixer::setManualAnimationScale ( int  coreAnimationId,
float  p 
)

Sets the scale of the manual animation to 0-1.

Sets the scale of the manual animation. The scale is different from the weight. The weights control the relative influence. The scale controls amplitude of the animation. An animation with zero scale but high relative influence, if applied, will drown out other animations that are composed with it, whereas an animation with one scale but zero weight will have no effect. It is an error to call this function for an animation that is not manual.

Returns
One of the following values:
  • true if manual
  • false if not manual

◆ setManualAnimationTime()

bool CalMixer::setManualAnimationTime ( int  coreAnimationId,
float  p 
)

Sets the time of the manual animation.

Sets the time of the manual animation. The effect of setting the time beyond either end of the animation's duration is to clamp the animation at its first or last frame. Manual animations do not turn off automatically, and you can set the time arbitrarily.

Returns
One of the following values:
  • true if exists and manual
  • false otherwise

◆ setManualAnimationWeight()

bool CalMixer::setManualAnimationWeight ( int  coreAnimationId,
float  p 
)

Sets the weight of the manual animation.

Sets the weight of the manual animation. Manual animations do not blend toward a weight target, so you set the weight directly, not a weight target. It is an error to call this function for an animation that is not manual.

Returns
One of the following values:
  • true if manual
  • false if not manual

◆ setTimeFactor()

void CalMixer::setTimeFactor ( float  timeFactor)

Set the time factor.

This function sets the time factor of the mixer instance. this time factor affect only sync animation

◆ stopAction()

bool CalMixer::stopAction ( int  coreAnimationId)

Stop the action.

Turn off an action.

Parameters
idThe ID of the core animation.
Returns
One of the following values:
  • true was playing (now stopped)
  • false if already not playing

◆ updateAnimation()

void CalMixer::updateAnimation ( float  deltaTime)
virtual

Updates all active animations.

This function updates all active animations of the mixer instance for a given amount of time.

Parameters
deltaTimeThe elapsed time in seconds since the last update.

Implements CalAbstractMixer.

◆ updateSkeleton()

void CalMixer::updateSkeleton ( )
virtual

Updates the skeleton of the corresponding CalModel (as provided to the create method) to match the current animation state (as updated by the last call to updateAnimation).

The tracks of each active animation are blended to compute the position and orientation of each bone of the skeleton. The updateAnimation method should be called just before calling updateSkeleton to define the set of active animations.

The CalModel::update method will call updateSkeleton immediately after updateAnimation if the instance was allocated by CalModel::create (in which case it is a CalMixer instance) or if the instance was set via CalModel::setAbstractMixer.

Implements CalAbstractMixer.


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

Generated by The Cal3D Team with Doxygen 1.8.14