#include "t3dmodel.h"
#include "t3dskeleton.h"
Go to the source code of this file.
|
|
#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 |
| |
|
| 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) |
| |
- Copyright
- 2024 - Max Bebök @license MIT
◆ t3d_anim_attach()
Attaches an animation to a skeleton.
- Parameters
-
| anim | The animation to attach |
| skeleton | The 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
-
| anim | animation to attach to |
| targetIdx | index of the target bone |
| target | position to update |
| updateFlag | set 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
-
| anim | animation to attach to |
| targetIdx | index of the target bone |
| target | rotation to update |
| updateFlag | set 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
-
| anim | animation to attach to |
| targetIdx | index of the target bone |
| target | scale to update |
| updateFlag | set to '1' if changed, '2' if animation rolled over |
◆ t3d_anim_create()
Creates an animation instance from a model's animation definition
- Parameters
-
| model | The model to create the animation from |
| name | The 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
-
◆ t3d_anim_get_length()
| static float t3d_anim_get_length |
( |
const T3DAnim * | anim | ) |
|
|
static |
Returns the length of an animation in seconds.
- Parameters
-
| anim | animation 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
-
| anim | animation 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
-
| anim | animation to set loop for |
| loop | true 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 | |
| isPlaying | true 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
-
| anim | animation to set speed for |
| speed | speed 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
-
| anim | animation to set time for |
| time | time 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
-
| anim | animation to update |
| deltaTime | time since last update (seconds) |