libpsys

diff src/psys_impl.h @ 0:1c8eb90a6989

initial commit
author John Tsiombikas <nuclear@mutantstargoat.com>
date Sat, 24 Sep 2011 07:22:07 +0300
parents
children 874a942853ad
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/psys_impl.h	Sat Sep 24 07:22:07 2011 +0300
     1.3 @@ -0,0 +1,68 @@
     1.4 +#ifndef PSYS_IMPL_H_
     1.5 +#define PSYS_IMPL_H_
     1.6 +
     1.7 +#include <anim/anim.h>
     1.8 +#include "psys.h"
     1.9 +
    1.10 +struct v3track {
    1.11 +	struct anm_track x, y, z;
    1.12 +};
    1.13 +
    1.14 +struct col_plane {
    1.15 +	plane_t p;
    1.16 +	float elasticity;
    1.17 +	struct col_plane *next;
    1.18 +};
    1.19 +
    1.20 +struct psys_particle;
    1.21 +
    1.22 +struct psys_emitter {
    1.23 +	float last_update;
    1.24 +
    1.25 +	struct anm_node prs;
    1.26 +
    1.27 +	struct anm_track rate;
    1.28 +	struct anm_track life;
    1.29 +	struct v3track dir;
    1.30 +	struct v3track grav;
    1.31 +
    1.32 +	float drag;	/* I don't think this needs to animate */
    1.33 +
    1.34 +	/* list of active particles */
    1.35 +	struct psys_particle *plist;
    1.36 +
    1.37 +	/* list of collision planes */
    1.38 +	struct col_plane *planes;
    1.39 +
    1.40 +	/* custom spawn closure */
    1.41 +	void *spawn_cls;
    1.42 +	psys_spawn_func_t spawn;
    1.43 +
    1.44 +	/* custom particle update closure */
    1.45 +	void *upd_cls;
    1.46 +	psys_update_func_t update;
    1.47 +
    1.48 +	/* custom draw closure */
    1.49 +	void *draw_cls;
    1.50 +	psys_draw_func_t draw;
    1.51 +	psys_draw_start_func_t draw_start;
    1.52 +	psys_draw_end_func_t draw_end;
    1.53 +
    1.54 +	/* calculated on update */
    1.55 +	vec3_t cur_pos;
    1.56 +	qut_t cur_rot;
    1.57 +	float cur_rate, cur_life;
    1.58 +	vec3_t cur_dir;
    1.59 +};
    1.60 +
    1.61 +
    1.62 +struct psys_particle {
    1.63 +	vec3_t pos, vel;
    1.64 +	float life, size, mass;
    1.65 +};
    1.66 +
    1.67 +void psys_gl_draw_start(struct psys_emitter *em, void *cls);
    1.68 +void psys_gl_draw(struct psys_emitter *em, struct psys_particle *p, void *cls);
    1.69 +void psys_gl_draw_end(struct psys_emitter *em, void *cls);
    1.70 +
    1.71 +#endif	/* PSYS_IMPL_H_ */