libanim

changeset 39:529036ffe7a5

backported the fixes from calacirya
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 25 Feb 2013 05:58:09 +0200
parents d5f855fb3097
children 28c9d38e80de
files src/anim.c src/track.c src/track.h
diffstat 3 files changed, 29 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/src/anim.c	Sun Sep 23 08:23:15 2012 +0300
     1.2 +++ b/src/anim.c	Mon Feb 25 05:58:09 2013 +0200
     1.3 @@ -325,6 +325,7 @@
     1.4  		pthread_mutex_unlock(&node->cache_list_lock);
     1.5  
     1.6  		cache->time = ANM_TIME_INVAL;
     1.7 +		cache->inv_time = ANM_TIME_INVAL;
     1.8  		pthread_setspecific(node->cache_key, cache);
     1.9  	}
    1.10  
    1.11 @@ -348,7 +349,7 @@
    1.12  
    1.13  		m4_translate(tmat, pos.x, pos.y, pos.z);
    1.14  		quat_to_mat4(rmat, rot);
    1.15 -		m4_translate(smat, scale.x, scale.y, scale.z);
    1.16 +		m4_scale(smat, scale.x, scale.y, scale.z);
    1.17  
    1.18  		/* ok this would look nicer in C++ */
    1.19  		m4_mult(cache->matrix, pivmat, tmat);
    1.20 @@ -380,6 +381,7 @@
    1.21  		pthread_mutex_unlock(&node->cache_list_lock);
    1.22  
    1.23  		cache->inv_time = ANM_TIME_INVAL;
    1.24 +		cache->inv_time = ANM_TIME_INVAL;
    1.25  		pthread_setspecific(node->cache_key, cache);
    1.26  	}
    1.27  
     2.1 --- a/src/track.c	Sun Sep 23 08:23:15 2012 +0300
     2.2 +++ b/src/track.c	Mon Feb 25 05:58:09 2013 +0200
     2.3 @@ -67,6 +67,27 @@
     2.4  	free(track);
     2.5  }
     2.6  
     2.7 +void anm_copy_track(struct anm_track *dest, struct anm_track *src)
     2.8 +{
     2.9 +	free(dest->name);
    2.10 +	if(dest->keys) {
    2.11 +		dynarr_free(dest->keys);
    2.12 +	}
    2.13 +
    2.14 +	if(src->name) {
    2.15 +		dest->name = malloc(strlen(src->name) + 1);
    2.16 +		strcpy(dest->name, src->name);
    2.17 +	}
    2.18 +
    2.19 +	dest->count = src->count;
    2.20 +	dest->keys = dynarr_alloc(src->count, sizeof *dest->keys);
    2.21 +	memcpy(dest->keys, src->keys, src->count * sizeof *dest->keys);
    2.22 +
    2.23 +	dest->def_val = src->def_val;
    2.24 +	dest->interp = src->interp;
    2.25 +	dest->extrap = src->extrap;
    2.26 +}
    2.27 +
    2.28  int anm_set_track_name(struct anm_track *track, const char *name)
    2.29  {
    2.30  	char *tmp;
     3.1 --- a/src/track.h	Sun Sep 23 08:23:15 2012 +0300
     3.2 +++ b/src/track.h	Mon Feb 25 05:58:09 2013 +0200
     3.3 @@ -55,6 +55,11 @@
     3.4  struct anm_track *anm_create_track(void);
     3.5  void anm_free_track(struct anm_track *track);
     3.6  
     3.7 +/* copies track src to dest
     3.8 + * XXX: dest must have been initialized first
     3.9 + */
    3.10 +void anm_copy_track(struct anm_track *dest, struct anm_track *src);
    3.11 +
    3.12  int anm_set_track_name(struct anm_track *track, const char *name);
    3.13  const char *anm_get_track_name(struct anm_track *track);
    3.14