projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix water splash sound
[carveJwlIkooP6JGAAIwe30JlM.git]
/
skeleton.h
diff --git
a/skeleton.h
b/skeleton.h
index b94fa68cb84af7f75fe4ef0edfb9c305c9162720..9729b64c04a95b7b052ba1daa3f280f444670a44 100644
(file)
--- a/
skeleton.h
+++ b/
skeleton.h
@@
-2,9
+2,8
@@
* Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved
*/
* Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved
*/
-#ifndef SKELETON_H
-#define SKELETON_H
-
+#pragma once
+#include "vg/vg_lines.h"
#include "model.h"
struct skeleton
#include "model.h"
struct skeleton
@@
-91,12
+90,18
@@
static void keyframe_rotate_around( mdl_keyframe *kf,
q_normalize( kf->q );
}
q_normalize( kf->q );
}
+static void keyframe_lerp( mdl_keyframe *kfa, mdl_keyframe *kfb, f32 t,
+ mdl_keyframe *kfd ){
+ v3_lerp( kfa->co, kfb->co, t, kfd->co );
+ q_nlerp( kfa->q, kfb->q, t, kfd->q );
+ v3_lerp( kfa->s, kfb->s, t, kfd->s );
+}
+
/*
* Lerp between two sets of keyframes and store in dest. Rotations use Nlerp.
*/
static void keyframe_lerp_pose( mdl_keyframe *kfa, mdl_keyframe *kfb,
/*
* Lerp between two sets of keyframes and store in dest. Rotations use Nlerp.
*/
static void keyframe_lerp_pose( mdl_keyframe *kfa, mdl_keyframe *kfb,
- float t, mdl_keyframe *kfd, int count )
-{
+ float t, mdl_keyframe *kfd, int count ){
if( t <= 0.0001f ){
keyframe_copy_pose( kfa, kfd, count );
return;
if( t <= 0.0001f ){
keyframe_copy_pose( kfa, kfd, count );
return;
@@
-106,11
+111,8
@@
static void keyframe_lerp_pose( mdl_keyframe *kfa, mdl_keyframe *kfb,
return;
}
return;
}
- for( int i=0; i<count; i++ ){
- v3_lerp( kfa[i].co, kfb[i].co, t, kfd[i].co );
- q_nlerp( kfa[i].q, kfb[i].q, t, kfd[i].q );
- v3_lerp( kfa[i].s, kfb[i].s, t, kfd[i].s );
- }
+ for( int i=0; i<count; i++ )
+ keyframe_lerp( kfa+i, kfb+i, t, kfd+i );
}
static
}
static
@@
-212,6
+214,7
@@
static void skeleton_apply_pose( struct skeleton *skele, mdl_keyframe *pose,
v3f *posemtx = final_mtx[i];
q_m3x3( kf->q, posemtx );
v3f *posemtx = final_mtx[i];
q_m3x3( kf->q, posemtx );
+ m3x3_scale( posemtx, kf->s );
v3_copy( kf->co, posemtx[3] );
}
return;
v3_copy( kf->co, posemtx[3] );
}
return;
@@
-239,6
+242,7
@@
static void skeleton_apply_pose( struct skeleton *skele, mdl_keyframe *pose,
/* pose matrix */
mdl_keyframe *kf = &pose[i-1];
q_m3x3( kf->q, posemtx );
/* pose matrix */
mdl_keyframe *kf = &pose[i-1];
q_m3x3( kf->q, posemtx );
+ m3x3_scale( posemtx, kf->s );
v3_copy( kf->co, posemtx[3] );
v3_add( temp_delta, posemtx[3], posemtx[3] );
v3_copy( kf->co, posemtx[3] );
v3_add( temp_delta, posemtx[3], posemtx[3] );
@@
-579,5
+583,3
@@
static void skeleton_debug( struct skeleton *skele, m4x3f *final_mtx ){
vg_line( p0, p1, 0xff00ffff );
}
}
vg_line( p0, p1, 0xff00ffff );
}
}
-
-#endif /* SKELETON_H */