Animation looping
This commit is contained in:
parent
f84505f36b
commit
26e44eb4bc
5
src/k3.c
5
src/k3.c
@ -404,6 +404,11 @@ static void anim_update(struct k3Animator *anim) {
|
|||||||
void k3AnimatorSet(struct k3Animator *anim, float time) {
|
void k3AnimatorSet(struct k3Animator *anim, float time) {
|
||||||
if(!anim->inter) anim->inter = _mm_malloc(sizeof(mat4) * anim->base->boneCount * anim->base->frameCount, 16);
|
if(!anim->inter) anim->inter = _mm_malloc(sizeof(mat4) * anim->base->boneCount * anim->base->frameCount, 16);
|
||||||
|
|
||||||
|
if(!anim->loop) {
|
||||||
|
time = fmaxf(time, 0);
|
||||||
|
time = fminf(time, (float) (anim->base->frameCount - 1) / anim->base->fps);
|
||||||
|
}
|
||||||
|
|
||||||
anim->time = time;
|
anim->time = time;
|
||||||
|
|
||||||
anim_update(anim);
|
anim_update(anim);
|
||||||
|
Loading…
Reference in New Issue
Block a user