1 | /** |
---|
2 | * @file rain_effect.h |
---|
3 | */ |
---|
4 | |
---|
5 | #ifndef _RAIN_EFFECT |
---|
6 | #define _RAIN_EFFECT |
---|
7 | |
---|
8 | #include "vector.h" |
---|
9 | #include "vector2D.h" |
---|
10 | #include <string> |
---|
11 | |
---|
12 | #include "particle_system.h" |
---|
13 | |
---|
14 | class SparkParticles; |
---|
15 | class PlainEmitter; |
---|
16 | |
---|
17 | #include "weather_effect.h" |
---|
18 | |
---|
19 | #include "sound_buffer.h" |
---|
20 | #include "sound_source.h" |
---|
21 | |
---|
22 | |
---|
23 | class RainEffect : public WeatherEffect |
---|
24 | { |
---|
25 | public: |
---|
26 | RainEffect(const TiXmlElement* root = NULL); |
---|
27 | virtual ~RainEffect(); |
---|
28 | |
---|
29 | virtual void loadParams(const TiXmlElement* root); |
---|
30 | |
---|
31 | virtual bool init(); |
---|
32 | |
---|
33 | virtual bool activate(); |
---|
34 | virtual bool deactivate(); |
---|
35 | |
---|
36 | void activateRain(); |
---|
37 | void deactivateRain(); |
---|
38 | |
---|
39 | virtual void tick(float dt); |
---|
40 | |
---|
41 | inline void setRainCoord(float x, float y, float z) { this->rainCoord = Vector(x, y, z); } |
---|
42 | inline void setRainSize(float x, float y) { this->rainSize = Vector2D(x, y); } |
---|
43 | inline void setRainRate(float rate) { this->rainRate = rate;} |
---|
44 | inline void setRainVelocity(float velocity) { this->rainVelocity = -velocity; } |
---|
45 | inline void setRainLife(float life) { this->rainLife = life; } |
---|
46 | inline void setRainWind(int force) { this->rainWindForce = force; } |
---|
47 | inline void setRainOption(const std::string& option) { if (option == "moverain") this->rainMove = true; } |
---|
48 | |
---|
49 | |
---|
50 | private: |
---|
51 | static SparkParticles* rainParticles; |
---|
52 | ParticleEmitter* emitter; |
---|
53 | |
---|
54 | Vector rainCoord; |
---|
55 | Vector2D rainSize; |
---|
56 | GLfloat rainRate; |
---|
57 | GLfloat rainVelocity; |
---|
58 | GLfloat rainLife; |
---|
59 | GLfloat rainMaxParticles; |
---|
60 | int rainWindForce; |
---|
61 | bool rainMove; |
---|
62 | |
---|
63 | OrxSound::SoundSource soundSource; |
---|
64 | OrxSound::SoundBuffer* rainBuffer; |
---|
65 | OrxSound::SoundBuffer* windBuffer; |
---|
66 | }; |
---|
67 | |
---|
68 | |
---|
69 | #endif /* _RAIN_EFFECT */ |
---|