vrshoot

diff libs/psys/pattr.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/psys/pattr.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,62 @@
     1.4 +#ifndef PATTR_H_
     1.5 +#define PATTR_H_
     1.6 +
     1.7 +#include "pstrack.h"
     1.8 +#include "rndval.h"
     1.9 +
    1.10 +/* the particle attributes vary from 0 to 1 during its lifetime */
    1.11 +struct psys_particle_attributes {
    1.12 +	struct psys_track3 color;
    1.13 +	struct psys_track alpha;
    1.14 +	struct psys_track size;
    1.15 +};
    1.16 +
    1.17 +struct psys_attributes {
    1.18 +	unsigned int tex;	/* OpenGL texture to use for the billboard */
    1.19 +
    1.20 +	struct psys_track3 spawn_range;	/* radius of emmiter */
    1.21 +	struct psys_track rate;			/* spawn rate particles per sec */
    1.22 +	struct psys_anm_rnd life;		/* particle life in seconds */
    1.23 +	struct psys_anm_rnd size;		/* base particle size */
    1.24 +	struct psys_anm_rnd3 dir;		/* particle shoot direction */
    1.25 +
    1.26 +	struct psys_track3 grav;		/* external force (usually gravity) */
    1.27 +	float drag;	/* I don't think this needs to animate */
    1.28 +
    1.29 +	/* particle attributes */
    1.30 +	struct psys_particle_attributes part_attr;
    1.31 +
    1.32 +	/* limits */
    1.33 +	int max_particles;
    1.34 +};
    1.35 +
    1.36 +#ifdef __cplusplus
    1.37 +extern "C" {
    1.38 +#endif
    1.39 +
    1.40 +void psys_texture_loader(unsigned int (*load)(const char*, void*), void (*unload)(unsigned int, void*), void *cls);
    1.41 +
    1.42 +struct psys_attributes *psys_create_attr(void);
    1.43 +void psys_free_attr(struct psys_attributes *attr);
    1.44 +
    1.45 +int psys_init_attr(struct psys_attributes *attr);
    1.46 +void psys_destroy_attr(struct psys_attributes *attr);
    1.47 +
    1.48 +/* copies particle system attributes src to dest
    1.49 + * XXX: dest must have been initialized first
    1.50 + */
    1.51 +void psys_copy_attr(struct psys_attributes *dest, const struct psys_attributes *src);
    1.52 +
    1.53 +void psys_eval_attr(struct psys_attributes *attr, anm_time_t tm);
    1.54 +
    1.55 +int psys_load_attr(struct psys_attributes *attr, const char *fname);
    1.56 +int psys_load_attr_stream(struct psys_attributes *attr, FILE *fp);
    1.57 +
    1.58 +int psys_save_attr(const struct psys_attributes *attr, const char *fname);
    1.59 +int psys_save_attr_stream(const struct psys_attributes *attr, FILE *fp);
    1.60 +
    1.61 +#ifdef __cplusplus
    1.62 +}
    1.63 +#endif
    1.64 +
    1.65 +#endif	/* PATTR_H_ */