Tiny3D
Loading...
Searching...
No Matches
t3danim.h File Reference
#include "t3dmodel.h"
#include "t3dskeleton.h"
Include dependency graph for t3danim.h:

Go to the source code of this file.

Data Structures

struct  T3DAnimTargetBase
 
struct  T3DAnimTargetQuat
 
struct  T3DAnimTargetScalar
 
struct  T3DAnim
 

Macros

#define T3D_ANIM_TARGET_TRANSLATION   0
 
#define T3D_ANIM_TARGET_SCALE_XYZ   1
 
#define T3D_ANIM_TARGET_SCALE_S   2
 
#define T3D_ANIM_TARGET_ROTATION   3
 

Functions

T3DAnim t3d_anim_create (const T3DModel *model, const char *name)
 
void t3d_anim_attach (T3DAnim *anim, const T3DSkeleton *skeleton)
 
void t3d_anim_attach_pos (T3DAnim *anim, uint32_t targetIdx, T3DVec3 *target, int32_t *updateFlag)
 
void t3d_anim_attach_rot (T3DAnim *anim, uint32_t targetIdx, T3DQuat *target, int32_t *updateFlag)
 
void t3d_anim_attach_scale (T3DAnim *anim, uint32_t targetIdx, T3DVec3 *target, int32_t *updateFlag)
 
void t3d_anim_update (T3DAnim *anim, float deltaTime)
 
void t3d_anim_set_time (T3DAnim *anim, float time)
 
static float t3d_anim_get_time (const T3DAnim *anim)
 
static float t3d_anim_get_length (const T3DAnim *anim)
 
static void t3d_anim_set_speed (T3DAnim *anim, float speed)
 
static void t3d_anim_set_playing (T3DAnim *anim, bool isPlaying)
 
static void t3d_anim_set_looping (T3DAnim *anim, bool loop)
 
void t3d_anim_destroy (T3DAnim *anim)
 

Detailed Description

Function Documentation

◆ t3d_anim_attach()

void t3d_anim_attach ( T3DAnim * anim,
const T3DSkeleton * skeleton )

Attaches an animation to a skeleton.

Parameters
animThe animation to attach
skeletonThe skeleton to attach the animation to

◆ t3d_anim_attach_pos()

void t3d_anim_attach_pos ( T3DAnim * anim,
uint32_t targetIdx,
T3DVec3 * target,
int32_t * updateFlag )

Attaches a single position target to a single channel target. This can be used to override an earlier attachment from 't3d_anim_attach'.

Parameters
animanimation to attach to
targetIdxindex of the target bone
targetposition to update
updateFlagset to '1' if changed, '2' if animation rolled over

◆ t3d_anim_attach_rot()

void t3d_anim_attach_rot ( T3DAnim * anim,
uint32_t targetIdx,
T3DQuat * target,
int32_t * updateFlag )

Attaches a single rotation target to a single channel target. This can be used to override an earlier attachment from 't3d_anim_attach'.

Parameters
animanimation to attach to
targetIdxindex of the target bone
targetrotation to update
updateFlagset to '1' if changed, '2' if animation rolled over

◆ t3d_anim_attach_scale()

void t3d_anim_attach_scale ( T3DAnim * anim,
uint32_t targetIdx,
T3DVec3 * target,
int32_t * updateFlag )

Attaches a single scale target to a single channel target. This can be used to override an earlier attachment from 't3d_anim_attach'.

Parameters
animanimation to attach to
targetIdxindex of the target bone
targetscale to update
updateFlagset to '1' if changed, '2' if animation rolled over

◆ t3d_anim_create()

T3DAnim t3d_anim_create ( const T3DModel * model,
const char * name )

Creates an animation instance from a model's animation definition

Parameters
modelThe model to create the animation from
nameThe name of the animation to create
Returns
The created animation

◆ t3d_anim_destroy()

void t3d_anim_destroy ( T3DAnim * anim)

Frees data allocated in the animation struct.

Parameters
anim

◆ t3d_anim_get_length()

static float t3d_anim_get_length ( const T3DAnim * anim)
static

Returns the length of an animation in seconds.

Parameters
animanimation to get length for
Returns
length in seconds

◆ t3d_anim_get_time()

static float t3d_anim_get_time ( const T3DAnim * anim)
static

Returns the current time of an animation in seconds. Alternatively, you can also read the 'time' member directly.

Parameters
animanimation to get time for
Returns
current time in seconds

◆ t3d_anim_set_looping()

static void t3d_anim_set_looping ( T3DAnim * anim,
bool loop )
inlinestatic

Sets the animation to loop or not. If the animation is not set to loop, you will have to call 't3d_anim_set_playing' to play it again.

Parameters
animanimation to set loop for
looptrue to loop, false to stop at the end

◆ t3d_anim_set_playing()

static void t3d_anim_set_playing ( T3DAnim * anim,
bool isPlaying )
inlinestatic

Set the animation to playing or paused. Note: this works independently of setting the speed to 0.

Parameters
anim
isPlayingtrue to play, false to pause

◆ t3d_anim_set_speed()

static void t3d_anim_set_speed ( T3DAnim * anim,
float speed )
inlinestatic

Sets the speed of the animation. Note: reverse playback (speed < 0) is currently not supported.

Parameters
animanimation to set speed for
speedspeed as a factor, default: 1.0

◆ t3d_anim_set_time()

void t3d_anim_set_time ( T3DAnim * anim,
float time )

Sets the animation to a specific time. Note: this may cause some work internally due to potential DMAs.

Parameters
animanimation to set time for
timetime in seconds

◆ t3d_anim_update()

void t3d_anim_update ( T3DAnim * anim,
float deltaTime )

Updates an animation, this will actually play it and apply the changes to the skeleton.

Parameters
animanimation to update
deltaTimetime since last update (seconds)