libanim

changeset 7:ffe668a61bca

made the kind of interpolation for quaternion tracks into a conditional block for testing (lerp/slerp), obviously defaults to slerp...
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 01 Mar 2013 09:44:20 +0200
parents b3312cf87715
children 2fe32e62e2a7
files src/anim.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/src/anim.c	Fri Mar 01 08:21:19 2013 +0200
     1.2 +++ b/src/anim.c	Fri Mar 01 09:44:20 2013 +0200
     1.3 @@ -4,6 +4,8 @@
     1.4  #include "anim.h"
     1.5  #include "dynarr.h"
     1.6  
     1.7 +#define ROT_USE_SLERP
     1.8 +
     1.9  static void invalidate_cache(struct anm_node *node);
    1.10  
    1.11  int anm_init_node(struct anm_node *node)
    1.12 @@ -200,13 +202,14 @@
    1.13  
    1.14  quat_t anm_get_node_rotation(struct anm_node *node, anm_time_t tm)
    1.15  {
    1.16 -	/*quat_t q;
    1.17 +#ifndef ROT_USE_SLERP
    1.18 +	quat_t q;
    1.19  	q.x = anm_get_value(node->tracks + ANM_TRACK_ROT_X, tm);
    1.20  	q.y = anm_get_value(node->tracks + ANM_TRACK_ROT_Y, tm);
    1.21  	q.z = anm_get_value(node->tracks + ANM_TRACK_ROT_Z, tm);
    1.22  	q.w = anm_get_value(node->tracks + ANM_TRACK_ROT_W, tm);
    1.23 -	return q;*/
    1.24 -
    1.25 +	return q;
    1.26 +#else
    1.27  	int idx0, idx1, last_idx;
    1.28  	anm_time_t tstart, tend;
    1.29  	float t, dt;
    1.30 @@ -267,6 +270,7 @@
    1.31  	q2.w = track_w->keys[idx1].val;
    1.32  
    1.33  	return quat_slerp(q1, q2, t);
    1.34 +#endif
    1.35  }
    1.36  
    1.37  void anm_set_scaling(struct anm_node *node, vec3_t scl, anm_time_t tm)