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 | class LightManager; |
---|
17 | |
---|
18 | #include "weather_effect.h" |
---|
19 | |
---|
20 | #include "sound_buffer.h" |
---|
21 | #include "sound_source.h" |
---|
22 | |
---|
23 | |
---|
24 | class RainEffect : public WeatherEffect |
---|
25 | { |
---|
26 | public: |
---|
27 | RainEffect(const TiXmlElement* root = NULL); |
---|
28 | virtual ~RainEffect(); |
---|
29 | |
---|
30 | virtual void loadParams(const TiXmlElement* root); |
---|
31 | |
---|
32 | virtual bool init(); |
---|
33 | |
---|
34 | virtual bool activate(); |
---|
35 | virtual bool deactivate(); |
---|
36 | |
---|
37 | virtual void tick(float dt); |
---|
38 | |
---|
39 | inline void activateRain() { this->activate(); } |
---|
40 | inline void deactivateRain() { this->deactivate(); } |
---|
41 | void startRaining(); |
---|
42 | |
---|
43 | inline void setRainCoord(float x, float y, float z) { this->rainCoord = Vector(x, y, z); } |
---|
44 | inline void setRainSize(float x, float y) { this->rainSize = Vector2D(x, y); } |
---|
45 | inline void setRainRate(float rate) { this->rainRate = rate;} |
---|
46 | inline void setRainVelocity(float velocity) { this->rainVelocity = -velocity; } |
---|
47 | inline void setRainLife(float life) { this->rainLife = life; } |
---|
48 | inline void setRainWind(int force) { this->rainWindForce = force; } |
---|
49 | inline void setRainStart(float duration) { this->rainStartDuration = duration; } |
---|
50 | |
---|
51 | inline void setRainOption(const std::string& option) { |
---|
52 | if (option == "moverain") this->rainMove = true; |
---|
53 | if (option == "activate") this->rainActivate = true; |
---|
54 | } |
---|
55 | |
---|
56 | |
---|
57 | private: |
---|
58 | static SparkParticles* rainParticles; |
---|
59 | ParticleEmitter* emitter; |
---|
60 | |
---|
61 | float localTimer; |
---|
62 | |
---|
63 | Vector rainCoord; |
---|
64 | Vector2D rainSize; |
---|
65 | GLfloat rainRate; |
---|
66 | GLfloat rainVelocity; |
---|
67 | GLfloat rainLife; |
---|
68 | GLfloat rainMaxParticles; |
---|
69 | int rainWindForce; |
---|
70 | GLfloat rainStartDuration; |
---|
71 | bool rainMove; |
---|
72 | bool rainActivate; |
---|
73 | |
---|
74 | OrxSound::SoundSource soundSource; |
---|
75 | OrxSound::SoundBuffer* rainBuffer; |
---|
76 | OrxSound::SoundBuffer* windBuffer; |
---|
77 | |
---|
78 | float soundRainVolume; |
---|
79 | |
---|
80 | LightManager* lightMan; |
---|
81 | GLfloat rainAmbient; |
---|
82 | |
---|
83 | }; |
---|
84 | |
---|
85 | #endif /* _RAIN_EFFECT */ |
---|