Kemena3D
Loading...
Searching...
No Matches
kemena::kAnimator Class Reference

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.
kSkeletalAnimationgetCurrentAnimation ()
 Currently active skeletal clip.
void calculateBoneTransform (const kNodeData *node, kMat4 parentTransform)
 Recursively computes bone transforms for the entire skeleton.
const std::vector< kMat4getFinalBoneMatrices () 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).
kAnimationgetObjectAnimation () const
 Returns the registered non-skeletal clip, or nullptr.

Detailed Description

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.

Constructor & Destructor Documentation

◆ kAnimator()

kemena::kAnimator::kAnimator ( kSkeletalAnimation * newAnimation)

Constructs an animator and sets the initial skeletal clip.

Parameters
newAnimationSkeletal animation to start playing.

Member Function Documentation

◆ addAnimation()

void kemena::kAnimator::addAnimation ( kSkeletalAnimation * newAnimation)

Registers an additional skeletal clip.

◆ calculateBoneTransform()

void kemena::kAnimator::calculateBoneTransform ( const kNodeData * node,
kMat4 parentTransform )

Recursively computes bone transforms for the entire skeleton.

Parameters
nodeCurrent hierarchy node being processed.
parentTransformAccumulated world transform of the parent bone.

◆ getCurrentAnimation()

kSkeletalAnimation * kemena::kAnimator::getCurrentAnimation ( )

Currently active skeletal clip.

◆ getFinalBoneMatrices()

const std::vector< kMat4 > kemena::kAnimator::getFinalBoneMatrices ( ) const

Per-bone world matrices ready for shader upload.

◆ getObjectAnimation()

kAnimation * kemena::kAnimator::getObjectAnimation ( ) const

Returns the registered non-skeletal clip, or nullptr.

◆ getSpeed()

float kemena::kAnimator::getSpeed ( )

Current global playback speed multiplier.

◆ playAnimation()

void kemena::kAnimator::playAnimation ( kSkeletalAnimation * animation)

Switches to a different skeletal clip and resets time.

◆ setCurrentTime()

void kemena::kAnimator::setCurrentTime ( float newTime)

Seeks to a specific time in the active clip (ticks).

◆ setObjectAnimation()

void kemena::kAnimator::setObjectAnimation ( kAnimation * clip)

Registers the active non-skeletal clip (no-op playback for now).

◆ setSpeed()

void kemena::kAnimator::setSpeed ( float newSpeed)

Sets the global playback speed multiplier.

◆ updateAnimation()

void kemena::kAnimator::updateAnimation ( float newDeltaTime,
int frameId )

Advances the active animation by one step.

Parameters
newDeltaTimeElapsed time since the last update in seconds.
frameIdFrame identifier — skips duplicate updates.

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