vrshoot

view 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 source
1 #ifndef PATTR_H_
2 #define PATTR_H_
4 #include "pstrack.h"
5 #include "rndval.h"
7 /* the particle attributes vary from 0 to 1 during its lifetime */
8 struct psys_particle_attributes {
9 struct psys_track3 color;
10 struct psys_track alpha;
11 struct psys_track size;
12 };
14 struct psys_attributes {
15 unsigned int tex; /* OpenGL texture to use for the billboard */
17 struct psys_track3 spawn_range; /* radius of emmiter */
18 struct psys_track rate; /* spawn rate particles per sec */
19 struct psys_anm_rnd life; /* particle life in seconds */
20 struct psys_anm_rnd size; /* base particle size */
21 struct psys_anm_rnd3 dir; /* particle shoot direction */
23 struct psys_track3 grav; /* external force (usually gravity) */
24 float drag; /* I don't think this needs to animate */
26 /* particle attributes */
27 struct psys_particle_attributes part_attr;
29 /* limits */
30 int max_particles;
31 };
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 void psys_texture_loader(unsigned int (*load)(const char*, void*), void (*unload)(unsigned int, void*), void *cls);
39 struct psys_attributes *psys_create_attr(void);
40 void psys_free_attr(struct psys_attributes *attr);
42 int psys_init_attr(struct psys_attributes *attr);
43 void psys_destroy_attr(struct psys_attributes *attr);
45 /* copies particle system attributes src to dest
46 * XXX: dest must have been initialized first
47 */
48 void psys_copy_attr(struct psys_attributes *dest, const struct psys_attributes *src);
50 void psys_eval_attr(struct psys_attributes *attr, anm_time_t tm);
52 int psys_load_attr(struct psys_attributes *attr, const char *fname);
53 int psys_load_attr_stream(struct psys_attributes *attr, FILE *fp);
55 int psys_save_attr(const struct psys_attributes *attr, const char *fname);
56 int psys_save_attr_stream(const struct psys_attributes *attr, FILE *fp);
58 #ifdef __cplusplus
59 }
60 #endif
62 #endif /* PATTR_H_ */