libpsys

diff src/psys.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.h	Sat Sep 24 07:22:07 2011 +0300
     1.3 @@ -0,0 +1,61 @@
     1.4 +#ifndef LIBPSYS_H_
     1.5 +#define LIBPSYS_H_
     1.6 +
     1.7 +/* emitter properties:
     1.8 + * - p/r/s (anim)
     1.9 + * - spawn rate (anim)
    1.10 + * - direction (anim)
    1.11 + *
    1.12 + * - collision planes
    1.13 + */
    1.14 +
    1.15 +struct psys_emitter;
    1.16 +struct psys_particle;
    1.17 +
    1.18 +typedef int (*psys_spawn_func_t)(struct psys_emitter*, struct psys_particle*, void*);
    1.19 +typedef void (*psys_update_func_t)(struct psys_emitter*, struct psys_particle*, float, float, void*);
    1.20 +
    1.21 +typedef void (*psys_draw_func_t)(struct psys_emitter*, struct psys_particle*, void*);
    1.22 +typedef void (*psys_draw_start_func_t)(struct psys_emitter*, void*);
    1.23 +typedef void (*psys_draw_end_func_t)(struct psys_emitter*, void*);
    1.24 +
    1.25 +
    1.26 +struct psys_emitter *psys_create(void);
    1.27 +void psys_free(struct psys_emitter *em);
    1.28 +
    1.29 +int psys_init(struct psys_emitter *em);
    1.30 +void psys_destroy(struct psys_emitter *em);
    1.31 +
    1.32 +/* set properties */
    1.33 +
    1.34 +void psys_set_pos(struct psys_emitter *em, vec3_t pos, float tm);
    1.35 +void psys_set_rot(struct psys_emitter *em, quat_t rot, float tm);
    1.36 +void psys_set_pivot(struct psys_emitter *em, vec3_t pivot);
    1.37 +
    1.38 +void psys_set_rate(struct psys_emitter *em, float rate, float tm);
    1.39 +void psys_set_dir(struct psys_emitter *em, vec3_t dir, float tm);
    1.40 +
    1.41 +void psys_clear_collision_planes(struct psys_emitter *em);
    1.42 +int psys_add_collision_plane(struct psys_emitter *em, plane_t plane, float elast);
    1.43 +
    1.44 +void psys_add_particle(struct psys_emitter *em, struct psys_particle *p);
    1.45 +
    1.46 +void psys_spawn_func(struct psys_emitter *em, psys_spawn_func_t func, void *cls);
    1.47 +void psys_update_func(struct psys_emitter *em, psys_update_func_t func, void *cls);
    1.48 +void psys_draw_func(struct psys_emitter *em, psys_draw_func_t draw,
    1.49 +		psys_draw_start_func_t start, psys_draw_end_func_t end, void *cls);
    1.50 +
    1.51 +
    1.52 +/* query emitter state */
    1.53 +vec3_t psys_get_pos(struct psys_emitter *em);
    1.54 +quat_t psys_get_rot(struct psys_emitter *em);
    1.55 +float psys_get_rate(struct psys_emitter *em);
    1.56 +float psys_get_life(struct psys_emitter *em);
    1.57 +vec3_t psys_get_dir(struct psys_emitter *em);
    1.58 +
    1.59 +/* update and render */
    1.60 +
    1.61 +void psys_update(struct psys_emitter *em, float tm);
    1.62 +void psys_draw(struct psys_emitter *em);
    1.63 +
    1.64 +#endif	/* LIBPSYS_H_ */