|
Kemena3D
|
Controls playback of animation clips. More...
#include <kanimator.h>
Public Member Functions | |
| kAnimator (kSkeletalAnimation *newAnimation) | |
| Constructs an animator and sets the initial skeletal clip. | |
| void | addAnimation (kSkeletalAnimation *newAnimation) |
| Registers an additional skeletal clip. | |
| void | updateAnimation (float newDeltaTime, int frameId) |
| Advances the active animation by one step. | |
| void | playAnimation (kSkeletalAnimation *animation) |
| Switches to a different skeletal clip and resets time. | |
| kSkeletalAnimation * | getCurrentAnimation () |
| Currently active skeletal clip. | |
| void | calculateBoneTransform (const kNodeData *node, kMat4 parentTransform) |
| Recursively computes bone transforms for the entire skeleton. | |
| const std::vector< kMat4 > | getFinalBoneMatrices () const |
| Per-bone world matrices ready for shader upload. | |
| void | setCurrentTime (float newTime) |
| Seeks to a specific time in the active clip (ticks). | |
| void | setSpeed (float newSpeed) |
| Sets the global playback speed multiplier. | |
| float | getSpeed () |
| Current global playback speed multiplier. | |
| void | setObjectAnimation (kAnimation *clip) |
| Registers the active non-skeletal clip (no-op playback for now). | |
| kAnimation * | getObjectAnimation () const |
| Returns the registered non-skeletal clip, or nullptr. | |
Controls playback of animation clips.
Today the animator only plays skeletal clips (kSkeletalAnimation): it produces a flat array of final bone matrices that the renderer uploads to the shader each frame via getFinalBoneMatrices().
Non-skeletal (object-transform) clips of type kAnimation are accepted through setObjectAnimation() / playObjectAnimation() but are not yet executed — the hooks are in place for the future cinematic editor; per-object track sampling will land alongside it.
| kemena::kAnimator::kAnimator | ( | kSkeletalAnimation * | newAnimation | ) |
Constructs an animator and sets the initial skeletal clip.
| newAnimation | Skeletal animation to start playing. |
| void kemena::kAnimator::addAnimation | ( | kSkeletalAnimation * | newAnimation | ) |
Registers an additional skeletal clip.
Recursively computes bone transforms for the entire skeleton.
| node | Current hierarchy node being processed. |
| parentTransform | Accumulated world transform of the parent bone. |
| kSkeletalAnimation * kemena::kAnimator::getCurrentAnimation | ( | ) |
Currently active skeletal clip.
| const std::vector< kMat4 > kemena::kAnimator::getFinalBoneMatrices | ( | ) | const |
Per-bone world matrices ready for shader upload.
| kAnimation * kemena::kAnimator::getObjectAnimation | ( | ) | const |
Returns the registered non-skeletal clip, or nullptr.
| float kemena::kAnimator::getSpeed | ( | ) |
Current global playback speed multiplier.
| void kemena::kAnimator::playAnimation | ( | kSkeletalAnimation * | animation | ) |
Switches to a different skeletal clip and resets time.
| void kemena::kAnimator::setCurrentTime | ( | float | newTime | ) |
Seeks to a specific time in the active clip (ticks).
| void kemena::kAnimator::setObjectAnimation | ( | kAnimation * | clip | ) |
Registers the active non-skeletal clip (no-op playback for now).
| void kemena::kAnimator::setSpeed | ( | float | newSpeed | ) |
Sets the global playback speed multiplier.
| void kemena::kAnimator::updateAnimation | ( | float | newDeltaTime, |
| int | frameId ) |
Advances the active animation by one step.
| newDeltaTime | Elapsed time since the last update in seconds. |
| frameId | Frame identifier — skips duplicate updates. |