diff options
Diffstat (limited to 'src/animation.c')
-rw-r--r-- | src/animation.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/animation.c b/src/animation.c index de7e9a2..7a79529 100644 --- a/src/animation.c +++ b/src/animation.c @@ -6,14 +6,14 @@ keyframe animation_sample(animation_sampler *sampler, f32 t) { size_t previous_index = 0; f32 previous_time = 0.0; // look forwards - DEBUG("%d\n", sampler->animation.values.kind); - TRACE("Here %d", sampler->animation.n_timestamps); - for (u32 i = 1; i < sampler->animation.n_timestamps; i++) { + // DEBUG("%d\n", sampler->animation.values.kind); + TRACE("Total timestamps %d", sampler->animation.n_timestamps); + for (u32 i = 0; i < sampler->animation.n_timestamps; i++) { f32 current_time = sampler->animation.timestamps[i]; if (current_time > t) { break; } - previous_time = current_time; + previous_time = sampler->animation.timestamps[i]; previous_index = i; } @@ -28,7 +28,7 @@ keyframe animation_sample(animation_sampler *sampler, f32 t) { f32 time_diff = sampler->animation.timestamps[next_index] - sampler->animation.timestamps[previous_index]; - f32 percent = (t - sampler->animation.timestamps[next_index]) / time_diff; + f32 percent = (t - previous_time) / time_diff; quat interpolated_rot = quat_slerp(sampler->animation.values.values[previous_index].rotation, |