libpsys

view src/psys_impl.h @ 2:6e5342a2529a

more stuff done
author John Tsiombikas <nuclear@mutantstargoat.com>
date Sun, 25 Sep 2011 04:26:51 +0300
parents 874a942853ad
children
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 unsigned int tex;
26 struct anm_track rate;
27 struct anm_track life;
28 struct v3track dir;
29 struct v3track grav;
31 float drag; /* I don't think this needs to animate */
33 /* list of active particles */
34 struct psys_particle *plist;
36 /* list of collision planes */
37 struct col_plane *planes;
39 /* custom spawn closure */
40 void *spawn_cls;
41 psys_spawn_func_t spawn;
43 /* custom particle update closure */
44 void *upd_cls;
45 psys_update_func_t update;
47 /* custom draw closure */
48 void *draw_cls;
49 psys_draw_func_t draw;
50 psys_draw_start_func_t draw_start;
51 psys_draw_end_func_t draw_end;
53 /* calculated on update */
54 vec3_t cur_pos;
55 quat_t cur_rot;
56 float cur_rate, cur_life;
57 vec3_t cur_dir;
58 vec3_t cur_grav;
60 /* partial spawn accumulator */
61 float spawn_acc;
62 };
65 struct psys_particle {
66 vec3_t pos, vel;
67 float life, size;
69 struct psys_particle *next;
70 };
72 void psys_gl_draw_start(struct psys_emitter *em, void *cls);
73 void psys_gl_draw(struct psys_emitter *em, struct psys_particle *p, void *cls);
74 void psys_gl_draw_end(struct psys_emitter *em, void *cls);
76 #endif /* PSYS_IMPL_H_ */