X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=skeleton.h;h=2be9a9aaff7ac7bd8945f9b5e37ed5d0ca0ff7ff;hb=8c6ba83d5eaab5922468e981c4e8b799d8f77e2f;hp=dc506abdde0df3b0908dcbddc4c5ccd7e6712d88;hpb=b615f03b922d155f9449d2a23d3cc18eed320ed3;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/skeleton.h b/skeleton.h index dc506ab..2be9a9a 100644 --- a/skeleton.h +++ b/skeleton.h @@ -134,13 +134,13 @@ VG_STATIC void skeleton_sample_anim( struct skeleton *skele, float time, mdl_keyframe *output ) { - float animtime = time*anim->rate; + f32 animtime = fmodf( time*anim->rate, anim->length ), + animframe = floorf( animtime ), + t = animtime - animframe; - u32 frame = ((u32)animtime) % anim->length, + u32 frame = (u32)animframe % anim->length, next = (frame+1) % anim->length; - float t = vg_fractf( animtime ); - mdl_keyframe *base = anim->anim_data + (skele->bone_count-1)*frame, *nbase = anim->anim_data + (skele->bone_count-1)*next;