GlistEngine
Loading...
Searching...
No Matches
gModelAnimator Class Reference

Handles animation logic for a gModel instance, including switching, playback, and timing. More...

#include <gModelAnimator.h>

Public Types

enum  Mode { MODE_HOLD_ON_LAST_FRAME , MODE_ONCE , MODE_REPEAT }
 Defines playback behavior for animations. More...
 
enum  TriggerType { TRIGGERTYPE_AFTER_COMPLETION }
 Defines triggers for transitioning animations. More...
 

Public Member Functions

 gModelAnimator ()
 
 ~gModelAnimator ()
 
void setModel (gModel *model)
 Associates a gModel with this animator.
 
void addAnimation (int id, int startframe, int endframe, float speed, Mode mode, bool isDefault=false)
 Adds a new animation to the animator.
 
void addTransition (TriggerType triggerType, int srcAnimation, int dstAnimation)
 Adds a transition to another animation.
 
void bake ()
 Finalizes the animator setup. Should be called before use and after the animator is fully configured.
 
void setGeneralSpeed (float speed)
 Sets a global animation speed multiplier.
 
void triggerAnimation (int animationId)
 Starts transitioning to a different animation.
 
void update ()
 

Detailed Description

Handles animation logic for a gModel instance, including switching, playback, and timing.

Supports multiple animation modes and allows defining transitions between animations.

Member Enumeration Documentation

◆ Mode

Defines playback behavior for animations.

Enumerator
MODE_HOLD_ON_LAST_FRAME 
MODE_ONCE 
MODE_REPEAT 

◆ TriggerType

Defines triggers for transitioning animations.

Enumerator
TRIGGERTYPE_AFTER_COMPLETION 

Constructor & Destructor Documentation

◆ gModelAnimator()

gModelAnimator::gModelAnimator ( )

◆ ~gModelAnimator()

gModelAnimator::~gModelAnimator ( )

Member Function Documentation

◆ addAnimation()

void gModelAnimator::addAnimation ( int  id,
int  startframe,
int  endframe,
float  speed,
Mode  mode,
bool  isDefault = false 
)

Adds a new animation to the animator.

Parameters
idUnique identifier for the animation.
startframeStarting frame of the animation.
endframeEnding frame of the animation. Cannot be the same as startframe
modeAnimation playback mode.
isDefaultWhether this animation is the default on bake.

◆ addTransition()

void gModelAnimator::addTransition ( TriggerType  triggerType,
int  srcAnimation,
int  dstAnimation 
)

Adds a transition to another animation.

Parameters
triggerTypeThe trigger condition.
srcAnimationSource animation ID.
dstAnimationDestination animation ID.

◆ bake()

void gModelAnimator::bake ( )

Finalizes the animator setup. Should be called before use and after the animator is fully configured.

◆ setGeneralSpeed()

void gModelAnimator::setGeneralSpeed ( float  speed)
inline

Sets a global animation speed multiplier.

Parameters
speedPlayback speed (1.0 = normal).

◆ setModel()

void gModelAnimator::setModel ( gModel model)
inline

Associates a gModel with this animator.

Parameters
modelThe model to animate.

◆ triggerAnimation()

void gModelAnimator::triggerAnimation ( int  animationId)

Starts transitioning to a different animation.

Parameters
animationIdThe animation to play.

◆ update()

void gModelAnimator::update ( )

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