libpsys

view 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 source
1 #ifndef PSYS_IMPL_H_
2 #define PSYS_IMPL_H_
4 #include <anim/anim.h>
5 #include "psys.h"
7 struct v3track {
8 struct anm_track x, y, z;
9 };
11 struct col_plane {
12 plane_t p;
13 float elasticity;
14 struct col_plane *next;
15 };
17 struct psys_particle;
19 struct psys_emitter {
20 float last_update;
22 struct anm_node prs;
24 struct anm_track rate;
25 struct anm_track life;
26 struct v3track dir;
27 struct v3track grav;
29 float drag; /* I don't think this needs to animate */
31 /* list of active particles */
32 struct psys_particle *plist;
34 /* list of collision planes */
35 struct col_plane *planes;
37 /* custom spawn closure */
38 void *spawn_cls;
39 psys_spawn_func_t spawn;
41 /* custom particle update closure */
42 void *upd_cls;
43 psys_update_func_t update;
45 /* custom draw closure */
46 void *draw_cls;
47 psys_draw_func_t draw;
48 psys_draw_start_func_t draw_start;
49 psys_draw_end_func_t draw_end;
51 /* calculated on update */
52 vec3_t cur_pos;
53 qut_t cur_rot;
54 float cur_rate, cur_life;
55 vec3_t cur_dir;
56 };
59 struct psys_particle {
60 vec3_t pos, vel;
61 float life, size, mass;
62 };
64 void psys_gl_draw_start(struct psys_emitter *em, void *cls);
65 void psys_gl_draw(struct psys_emitter *em, struct psys_particle *p, void *cls);
66 void psys_gl_draw_end(struct psys_emitter *em, void *cls);
68 #endif /* PSYS_IMPL_H_ */