summaryrefslogtreecommitdiff
path: root/src/animation.c
diff options
context:
space:
mode:
authoromnisci3nce <17525998+omnisci3nce@users.noreply.github.com>2024-04-07 21:46:51 +1000
committeromnisci3nce <17525998+omnisci3nce@users.noreply.github.com>2024-04-07 21:46:51 +1000
commit61d96cf09e2e125f36a94a4c64ed5682fda0df1c (patch)
treeaa79fe48e1a0800bec0157460a4adf7d19d88077 /src/animation.c
parent42924fe7b32e93bf55ce034467ceb52e0436c303 (diff)
its bending but not deforming as expected, looks like rotating around model origin
Diffstat (limited to 'src/animation.c')
-rw-r--r--src/animation.c10
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,