libpsys

changeset 4:0fe624ffcb4f

reorg
author John Tsiombikas <nuclear@mutantstargoat.com>
date Mon, 26 Sep 2011 18:25:18 +0300
parents 133094e2f5a5
children 613d2bf3ea1f
files src/psys.c
diffstat 1 files changed, 17 insertions(+), 53 deletions(-) [+]
line diff
     1.1 --- a/src/psys.c	Mon Sep 26 18:20:11 2011 +0300
     1.2 +++ b/src/psys.c	Mon Sep 26 18:25:18 2011 +0300
     1.3 @@ -8,10 +8,10 @@
     1.4  static int spawn(struct psys_emitter *em, struct psys_particle *p, void *cls);
     1.5  static void update_particle(struct psys_emitter *em, struct psys_particle *p, float tm, float dt, void *cls);
     1.6  
     1.7 -static int init_v3track(struct v3track *v3t);
     1.8 -static void destroy_v3track(struct v3track *v3t);
     1.9 -static void set_v3value(struct v3track *v3t, anm_time_t tm, vec3_t v);
    1.10 -static vec3_t get_v3value(struct v3track *v3t, anm_time_t tm);
    1.11 +static int init_anm_track_vec3(struct anm_track_vec3 *v3t);
    1.12 +static void destroy_anm_track_vec3(struct anm_track_vec3 *v3t);
    1.13 +static void set_v3value(struct anm_track_vec3 *v3t, anm_time_t tm, vec3_t v);
    1.14 +static vec3_t get_v3value(struct anm_track_vec3 *v3t, anm_time_t tm);
    1.15  
    1.16  static float random_val(float x, float range);
    1.17  static vec3_t random_vec3(vec3_t v, vec3_t range);
    1.18 @@ -52,7 +52,7 @@
    1.19  
    1.20  	if(anm_init_node(&em->prs) == -1)
    1.21  		goto err;
    1.22 -	if(init_v3track(&em->pos_range) == -1)
    1.23 +	if(init_anm_track_vec3(&em->pos_range) == -1)
    1.24  		goto err;
    1.25  	if(anm_init_track(&em->rate) == -1)
    1.26  		goto err;
    1.27 @@ -64,11 +64,11 @@
    1.28  		goto err;
    1.29  	if(anm_init_track(&em->size_range) == -1)
    1.30  		goto err;
    1.31 -	if(init_v3track(&em->dir) == -1)
    1.32 +	if(init_anm_track_vec3(&em->dir) == -1)
    1.33  		goto err;
    1.34 -	if(init_v3track(&em->dir_range) == -1)
    1.35 +	if(init_anm_track_vec3(&em->dir_range) == -1)
    1.36  		goto err;
    1.37 -	if(init_v3track(&em->grav) == -1)
    1.38 +	if(init_anm_track_vec3(&em->grav) == -1)
    1.39  		goto err;
    1.40  
    1.41  	em->spawn = spawn;
    1.42 @@ -96,14 +96,14 @@
    1.43  	}
    1.44  
    1.45  	anm_destroy_node(&em->prs);
    1.46 -	destroy_v3track(&em->pos_range);
    1.47 +	destroy_anm_track_vec3(&em->pos_range);
    1.48  	anm_destroy_track(&em->rate);
    1.49  	anm_destroy_track(&em->life);
    1.50  	anm_destroy_track(&em->size);
    1.51  	anm_destroy_track(&em->size_range);
    1.52 -	destroy_v3track(&em->dir);
    1.53 -	destroy_v3track(&em->dir_range);
    1.54 -	destroy_v3track(&em->grav);
    1.55 +	destroy_anm_track_vec3(&em->dir);
    1.56 +	destroy_anm_track_vec3(&em->dir_range);
    1.57 +	destroy_anm_track_vec3(&em->grav);
    1.58  }
    1.59  
    1.60  void psys_set_texture(struct psys_emitter *em, unsigned int tex)
    1.61 @@ -209,42 +209,6 @@
    1.62  	em->draw_cls = cls;
    1.63  }
    1.64  
    1.65 -/* --- query current state --- */
    1.66 -unsigned int psys_get_texture(struct psys_emitter *em)
    1.67 -{
    1.68 -	return em->tex;
    1.69 -}
    1.70 -
    1.71 -vec3_t psys_get_pos(struct psys_emitter *em)
    1.72 -{
    1.73 -	return em->cur_pos;
    1.74 -}
    1.75 -
    1.76 -quat_t psys_get_rot(struct psys_emitter *em)
    1.77 -{
    1.78 -	return em->cur_rot;
    1.79 -}
    1.80 -
    1.81 -float psys_get_rate(struct psys_emitter *em)
    1.82 -{
    1.83 -	return em->cur_rate;
    1.84 -}
    1.85 -
    1.86 -float psys_get_life(struct psys_emitter *em)
    1.87 -{
    1.88 -	return em->cur_life;
    1.89 -}
    1.90 -
    1.91 -vec3_t psys_get_dir(struct psys_emitter *em)
    1.92 -{
    1.93 -	return em->cur_dir;
    1.94 -}
    1.95 -
    1.96 -vec3_t psys_get_grav(struct psys_emitter *em)
    1.97 -{
    1.98 -	return em->cur_grav;
    1.99 -}
   1.100 -
   1.101  /* --- update and render --- */
   1.102  
   1.103  void psys_update(struct psys_emitter *em, float tm)
   1.104 @@ -362,9 +326,9 @@
   1.105  	p->life -= dt;
   1.106  }
   1.107  
   1.108 -/* --- v3track helper --- */
   1.109 +/* --- anm_track_vec3 helper --- */
   1.110  
   1.111 -int init_v3track(struct v3track *v3t)
   1.112 +int init_anm_track_vec3(struct anm_track_vec3 *v3t)
   1.113  {
   1.114  	if(anm_init_track(&v3t->x) == -1) {
   1.115  		return -1;
   1.116 @@ -381,21 +345,21 @@
   1.117  	return 0;
   1.118  }
   1.119  
   1.120 -static void destroy_v3track(struct v3track *v3t)
   1.121 +static void destroy_anm_track_vec3(struct anm_track_vec3 *v3t)
   1.122  {
   1.123  	anm_destroy_track(&v3t->x);
   1.124  	anm_destroy_track(&v3t->y);
   1.125  	anm_destroy_track(&v3t->z);
   1.126  }
   1.127  
   1.128 -static void set_v3value(struct v3track *v3t, anm_time_t tm, vec3_t v)
   1.129 +static void set_v3value(struct anm_track_vec3 *v3t, anm_time_t tm, vec3_t v)
   1.130  {
   1.131  	anm_set_value(&v3t->x, tm, v.x);
   1.132  	anm_set_value(&v3t->y, tm, v.y);
   1.133  	anm_set_value(&v3t->z, tm, v.z);
   1.134  }
   1.135  
   1.136 -static vec3_t get_v3value(struct v3track *v3t, anm_time_t tm)
   1.137 +static vec3_t get_v3value(struct anm_track_vec3 *v3t, anm_time_t tm)
   1.138  {
   1.139  	vec3_t v;
   1.140  	v.x = anm_get_value(&v3t->x, tm);