seperate gamestate and animator memory (BREAKS: SMOOTHED UPPER YAW)
[carveJwlIkooP6JGAAIwe30JlM.git] / skeleton.h
index dc506abdde0df3b0908dcbddc4c5ccd7e6712d88..2be9a9aaff7ac7bd8945f9b5e37ed5d0ca0ff7ff 100644 (file)
@@ -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;