- Cal3D 0.11 API Reference - |
Public Member Functions | |
CalMixer (CalModel *pModel) | |
Constructs the mixer instance. | |
virtual | ~CalMixer () |
Destructs the mixer instance. | |
virtual bool | isDefaultMixer () const |
Is the object an instance of the default mixer (i.e. | |
bool | blendCycle (int id, float weight, float delay) |
Interpolates the weight of an animation cycle. | |
bool | clearCycle (int id, float delay) |
Fades an animation cycle out. | |
bool | executeAction (int id, float delayIn, float delayOut, float weightTarget=1.0f, bool autoLock=false) |
Executes an animation action. | |
bool | removeAction (int id) |
Clears an active animation action. | |
virtual void | updateAnimation (float deltaTime) |
Updates all active animations. | |
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). | |
float | getAnimationTime () const |
Returns the animation time. | |
float | getAnimationDuration () const |
Returns the animation duration. | |
void | setAnimationTime (float animationTime) |
Sets the animation time. | |
void | setTimeFactor (float timeFactor) |
Set the time factor. | |
float | getTimeFactor () const |
Get the time factor. | |
CalModel * | getCalModel () |
Get the model. | |
const CalModel * | getCalModel () const |
Get the model. | |
std::vector< CalAnimation * > & | getAnimationVector () |
Get the animation vector. | |
const std::vector< CalAnimation * > & | getAnimationVector () const |
Get the animation vector. | |
std::list< CalAnimationAction * > & | getAnimationActionList () |
Get the list of the action animation. | |
const std::list< CalAnimationAction * > & | getAnimationActionList () const |
Get the list of the action animation. | |
std::list< CalAnimationCycle * > & | getAnimationCycle () |
Get the list of the cycle animation. | |
const std::list< CalAnimationCycle * > & | getAnimationCycle () const |
Get the list of the cycle animation. | |
bool | actionOn (int coreAnimationId) |
Is action playing? | |
bool | stopAction (int coreAnimationId) |
Stop the action. | |
bool | addManualAnimation (int coreAnimationId) |
Add a manual animation instance. | |
bool | removeManualAnimation (int coreAnimationId) |
Remove a manual animation instance. | |
bool | setManualAnimationOn (int coreAnimationId, bool) |
Sets the manual animation on or off. | |
bool | setManualAnimationTime (int coreAnimationId, float seconds) |
Sets the time of the manual animation. | |
bool | setManualAnimationWeight (int coreAnimationId, float) |
Sets the weight of the manual animation. | |
bool | setManualAnimationScale (int coreAnimationId, float p) |
Sets the scale of the manual animation to 0-1. | |
bool | setManualAnimationRampValue (int coreAnimationId, float p) |
Sets the RampValue of the manual animation to 0-1. | |
bool | setManualAnimationCompositionFunction (int coreAnimationId, CalAnimation::CompositionFunction p) |
Sets the composition function, which controls how animation blends with other simultaneous animations. | |
bool | setManualAnimationAttributes (int coreAnimationId, CalMixerManualAnimationAttributes const &p) |
Sets all the manual animation attributes. | |
bool | animationDuration (int coreAnimationId, float *result) |
Return duration of the core animation in seconds. | |
bool | addBoneAdjustment (int boneId, CalMixerBoneAdjustment const &) |
bool | removeBoneAdjustment (int boneId) |
void | removeAllBoneAdjustments () |
unsigned int | numActiveOneShotAnimations () |
CalAnimationAction * | animationActionFromCoreAnimationId (int coreAnimationId) |
This function returns CalAnimationAction for given coreAnimationId. | |
CalAnimationAction * | newAnimationAction (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 | |
CalModel * | m_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] |
CalMixer::CalMixer | ( | CalModel * | pModel | ) |
Constructs the mixer instance.
This function is the default constructor of the mixer instance.
|
virtual |
Destructs the mixer instance.
This function is the destructor of the mixer instance.
bool CalMixer::actionOn | ( | int | coreAnimationId | ) |
Is action playing?
Actions turn off automatically so you might need to know if one is playing.
id | The ID of the core animation. |
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.
id | The ID of the core animation. |
CalAnimationAction * CalMixer::animationActionFromCoreAnimationId | ( | int | coreAnimationId | ) |
This function returns CalAnimationAction for given coreAnimationId.
This function returns CalAnimationAction for given coreAnimationId.
id | The ID of the core animation. |
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.
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.
id | The ID of the animation cycle that should be blended. |
weight | The weight to interpolate the animation cycle to. |
delay | The time in seconds until the new weight should be reached. |
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.
id | The ID of the animation cycle that should be faded out. |
delay | The time in seconds until the the animation cycle is completely removed. |
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.
id | The ID of the animation action that should be blended. |
delayIn | The time in seconds until the animation action reaches the full weight from the beginning of its execution. |
delayOut | The time in seconds in which the animation action reaches zero weight at the end of its execution. |
weightTarget | The weight to interpolate the animation action to. |
autoLock | This prevents the Action from being reset and removed on the last keyframe if true. |
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.
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.
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.
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.
float CalMixer::getAnimationDuration | ( | ) | const |
Returns the animation duration.
This function returns the animation duration of the mixer instance.
float CalMixer::getAnimationTime | ( | ) | const |
Returns the animation time.
This function returns the animation time of the mixer instance.
std::vector< CalAnimation * > & CalMixer::getAnimationVector | ( | ) |
Get the animation vector.
This function return the animation vector of the mixer instance.
const std::vector< CalAnimation * > & CalMixer::getAnimationVector | ( | ) | const |
Get the animation vector.
This function return the animation vector of the mixer instance.
CalModel * CalMixer::getCalModel | ( | ) |
Get the model.
This function return the CalModel of the mixer instance.
const CalModel * CalMixer::getCalModel | ( | ) | const |
Get the model.
This function return the CalModel of the mixer instance.
float CalMixer::getTimeFactor | ( | ) | const |
Get the time factor.
This function return the time factor of the mixer instance.
|
inlinevirtual |
Is the object an instance of the default mixer (i.e.
an instance of CalMixer) ?
Reimplemented from CalAbstractMixer.
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.
id | The ID of the animation action that should be removed. |
bool CalMixer::removeManualAnimation | ( | int | coreAnimationId | ) |
Remove a manual animation instance.
Remove a manual animation instance for this core animation if one already exists.
id | The ID of the core animation. |
void CalMixer::setAnimationTime | ( | float | animationTime | ) |
Sets the animation time.
This function sets the animation time of the mixer instance.
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.
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.
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.
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.
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.
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.
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.
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
bool CalMixer::stopAction | ( | int | coreAnimationId | ) |
Stop the action.
Turn off an action.
id | The ID of the core animation. |
|
virtual |
Updates all active animations.
This function updates all active animations of the mixer instance for a given amount of time.
deltaTime | The elapsed time in seconds since the last update. |
Implements CalAbstractMixer.
|
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.