1 | /** |
---|
2 | * @file snow_effect.h |
---|
3 | */ |
---|
4 | |
---|
5 | #ifndef _SNOW_EFFECT |
---|
6 | #define _SNOW_EFFECT |
---|
7 | |
---|
8 | #include "vector.h" |
---|
9 | #include "particle_system.h" |
---|
10 | #include "material.h" |
---|
11 | #include "vector2D.h" |
---|
12 | |
---|
13 | #include "weather_effect.h" |
---|
14 | |
---|
15 | class SpriteParticles; |
---|
16 | class PlaneEmitter; |
---|
17 | class PNode; |
---|
18 | |
---|
19 | class SnowEffect : public WeatherEffect |
---|
20 | { |
---|
21 | public: |
---|
22 | SnowEffect(const TiXmlElement* root = NULL); |
---|
23 | virtual ~SnowEffect(); |
---|
24 | |
---|
25 | virtual void loadParams(const TiXmlElement* root); |
---|
26 | |
---|
27 | virtual bool init(); |
---|
28 | |
---|
29 | virtual bool activate(); |
---|
30 | virtual bool deactivate(); |
---|
31 | |
---|
32 | virtual void draw() const; |
---|
33 | virtual void tick(float dt); |
---|
34 | |
---|
35 | void activateSnow(); |
---|
36 | void deactivateSnow(); |
---|
37 | |
---|
38 | private: |
---|
39 | void numParticles(int n) { this->particles = n; } |
---|
40 | void materialTexture(const std::string& texture) { this->texture = texture; } |
---|
41 | void lifeSpan(float lifeSpan, float randomLifeSpan) { this->life = lifeSpan; this->randomLife = randomLifeSpan; } |
---|
42 | void radius(float radius, float randomRadius) { this->snowRadius = radius; this->randomRadius = randomRadius; } |
---|
43 | void mass(float mass, float randomMass) { this->snowMass = mass; this->randomMass = randomMass; } |
---|
44 | void emissionRate(float emissionRate){ this->rate = emissionRate; } |
---|
45 | void emissionVelocity(float velocity, float randomVelocity){ this->velocity = velocity; this->randomVelocity = randomVelocity; } |
---|
46 | void spread(float angle, float randomAngle) { this->angle = angle; this->randomAngle = randomAngle; } |
---|
47 | void size(float sizeX, float sizeY) { this->snowSize = Vector2D(sizeX, sizeY); } |
---|
48 | void coord(float x, float y, float z) { this->snowCoord = Vector(x, y, z); } |
---|
49 | |
---|
50 | int particles; |
---|
51 | std::string texture; |
---|
52 | float life, randomLife; |
---|
53 | float snowRadius, randomRadius; |
---|
54 | float snowMass, randomMass; |
---|
55 | float rate; |
---|
56 | float velocity, randomVelocity; |
---|
57 | float angle, randomAngle; |
---|
58 | float alpha; |
---|
59 | Vector snowCoord; |
---|
60 | Vector2D snowSize; |
---|
61 | |
---|
62 | bool activated; |
---|
63 | |
---|
64 | static SpriteParticles* snowParticles; |
---|
65 | |
---|
66 | PlaneEmitter* emitter; |
---|
67 | }; |
---|
68 | |
---|
69 | |
---|
70 | #endif /* _SNOW_EFFECT */ |
---|