rev |
line source |
nuclear@0
|
1 #ifndef PSYSPP_H_
|
nuclear@0
|
2 #define PSYSPP_H_
|
nuclear@0
|
3
|
nuclear@0
|
4 #include "xform_node.h"
|
nuclear@0
|
5 #include "texture.h"
|
nuclear@0
|
6 #include <psys/psys.h>
|
nuclear@0
|
7
|
nuclear@0
|
8 class ParticleSystemAttributes {
|
nuclear@0
|
9 private:
|
nuclear@0
|
10 Texture *tex;
|
nuclear@0
|
11 psys_attributes *psattr;
|
nuclear@0
|
12 bool own_psattr;
|
nuclear@0
|
13
|
nuclear@0
|
14 public:
|
nuclear@0
|
15 ParticleSystemAttributes();
|
nuclear@0
|
16 ParticleSystemAttributes(psys_attributes *psattr);
|
nuclear@0
|
17 ~ParticleSystemAttributes();
|
nuclear@0
|
18
|
nuclear@0
|
19 ParticleSystemAttributes(const ParticleSystemAttributes &rhs);
|
nuclear@0
|
20 ParticleSystemAttributes &operator =(const ParticleSystemAttributes &rhs);
|
nuclear@0
|
21
|
nuclear@0
|
22 bool load(const char *fname);
|
nuclear@0
|
23 bool load(FILE *fp);
|
nuclear@0
|
24 bool save(const char *fname) const;
|
nuclear@0
|
25 bool save(FILE *fp) const;
|
nuclear@0
|
26
|
nuclear@0
|
27 // particle attributes
|
nuclear@0
|
28 void set_part_color(const Vector3 &color, float t = 0);
|
nuclear@0
|
29 void set_part_alpha(float alpha, float t = 0);
|
nuclear@0
|
30 void set_part_scale(float size, float t = 0);
|
nuclear@0
|
31
|
nuclear@0
|
32 // emmiter attributes
|
nuclear@0
|
33 void set_texture(Texture *tex);
|
nuclear@0
|
34 Texture *get_texture() const;
|
nuclear@0
|
35
|
nuclear@0
|
36 void set_spawn_range(const Vector3 &range, long tm = 0);
|
nuclear@0
|
37
|
nuclear@0
|
38 void set_spawn_rate(float rate, long tm = 0);
|
nuclear@0
|
39 float get_spawn_rate(long tm = 0) const;
|
nuclear@0
|
40
|
nuclear@0
|
41 void set_life(float life, float range = 0.0, long tm = 0);
|
nuclear@0
|
42 void set_size(float sz, float range = 0.0, long tm = 0);
|
nuclear@0
|
43 void set_spawn_dir(const Vector3 &dir, const Vector3 &range = Vector3(0, 0, 0), long tm = 0);
|
nuclear@0
|
44
|
nuclear@0
|
45 void set_gravity(const Vector3 &grav, long tm = 0);
|
nuclear@0
|
46 void set_drag(float drag);
|
nuclear@0
|
47
|
nuclear@0
|
48 void set_particle_limit(int lim);
|
nuclear@0
|
49 };
|
nuclear@0
|
50
|
nuclear@0
|
51 class ParticleSystem : public XFormNode {
|
nuclear@0
|
52 private:
|
nuclear@0
|
53 psys_emitter psys;
|
nuclear@0
|
54 ParticleSystemAttributes attr;
|
nuclear@0
|
55
|
nuclear@0
|
56 long start_time; // subtracted from all time calculations
|
nuclear@0
|
57 long last_upd_time;
|
nuclear@0
|
58
|
nuclear@0
|
59 public:
|
nuclear@0
|
60 ParticleSystem();
|
nuclear@0
|
61 ~ParticleSystem();
|
nuclear@0
|
62
|
nuclear@0
|
63 void set_start_time(long tm);
|
nuclear@0
|
64
|
nuclear@0
|
65 bool is_active() const;
|
nuclear@0
|
66
|
nuclear@0
|
67 ParticleSystemAttributes *get_attr();
|
nuclear@0
|
68 const ParticleSystemAttributes *get_attr() const;
|
nuclear@0
|
69
|
nuclear@0
|
70 void set_attr(const ParticleSystemAttributes &pattr);
|
nuclear@0
|
71
|
nuclear@0
|
72 bool load(const char *fname);
|
nuclear@0
|
73 bool save(const char *fname) const;
|
nuclear@0
|
74
|
nuclear@0
|
75 void update(long tm);
|
nuclear@0
|
76 void draw() const;
|
nuclear@0
|
77 };
|
nuclear@0
|
78
|
nuclear@0
|
79 #endif // PSYSPP_H_
|