vrshoot

view src/psyspp.h @ 2:334d17aed7de

visual studio project files
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 18:36:38 +0200
parents
children
line source
1 #ifndef PSYSPP_H_
2 #define PSYSPP_H_
4 #include "xform_node.h"
5 #include "texture.h"
6 #include <psys/psys.h>
8 class ParticleSystemAttributes {
9 private:
10 Texture *tex;
11 psys_attributes *psattr;
12 bool own_psattr;
14 public:
15 ParticleSystemAttributes();
16 ParticleSystemAttributes(psys_attributes *psattr);
17 ~ParticleSystemAttributes();
19 ParticleSystemAttributes(const ParticleSystemAttributes &rhs);
20 ParticleSystemAttributes &operator =(const ParticleSystemAttributes &rhs);
22 bool load(const char *fname);
23 bool load(FILE *fp);
24 bool save(const char *fname) const;
25 bool save(FILE *fp) const;
27 // particle attributes
28 void set_part_color(const Vector3 &color, float t = 0);
29 void set_part_alpha(float alpha, float t = 0);
30 void set_part_scale(float size, float t = 0);
32 // emmiter attributes
33 void set_texture(Texture *tex);
34 Texture *get_texture() const;
36 void set_spawn_range(const Vector3 &range, long tm = 0);
38 void set_spawn_rate(float rate, long tm = 0);
39 float get_spawn_rate(long tm = 0) const;
41 void set_life(float life, float range = 0.0, long tm = 0);
42 void set_size(float sz, float range = 0.0, long tm = 0);
43 void set_spawn_dir(const Vector3 &dir, const Vector3 &range = Vector3(0, 0, 0), long tm = 0);
45 void set_gravity(const Vector3 &grav, long tm = 0);
46 void set_drag(float drag);
48 void set_particle_limit(int lim);
49 };
51 class ParticleSystem : public XFormNode {
52 private:
53 psys_emitter psys;
54 ParticleSystemAttributes attr;
56 long start_time; // subtracted from all time calculations
57 long last_upd_time;
59 public:
60 ParticleSystem();
61 ~ParticleSystem();
63 void set_start_time(long tm);
65 bool is_active() const;
67 ParticleSystemAttributes *get_attr();
68 const ParticleSystemAttributes *get_attr() const;
70 void set_attr(const ParticleSystemAttributes &pattr);
72 bool load(const char *fname);
73 bool save(const char *fname) const;
75 void update(long tm);
76 void draw() const;
77 };
79 #endif // PSYSPP_H_