[7561] | 1 | /** |
---|
[7652] | 2 | * @file rain_effect.h |
---|
| 3 | */ |
---|
[7561] | 4 | |
---|
| 5 | #ifndef _RAIN_EFFECT |
---|
| 6 | #define _RAIN_EFFECT |
---|
| 7 | |
---|
[7562] | 8 | #include "vector.h" |
---|
[7628] | 9 | #include "vector2D.h" |
---|
[7685] | 10 | #include <string> |
---|
[7628] | 11 | |
---|
[7561] | 12 | #include "particle_system.h" |
---|
| 13 | |
---|
[7577] | 14 | class SparkParticles; |
---|
[7628] | 15 | class PlainEmitter; |
---|
[8255] | 16 | class LightManager; |
---|
[7577] | 17 | |
---|
[7561] | 18 | #include "weather_effect.h" |
---|
| 19 | |
---|
[7646] | 20 | #include "sound_buffer.h" |
---|
| 21 | #include "sound_source.h" |
---|
[7562] | 22 | |
---|
[7646] | 23 | |
---|
[7561] | 24 | class RainEffect : public WeatherEffect |
---|
| 25 | { |
---|
[7652] | 26 | public: |
---|
| 27 | RainEffect(const TiXmlElement* root = NULL); |
---|
| 28 | virtual ~RainEffect(); |
---|
[7561] | 29 | |
---|
[7652] | 30 | virtual void loadParams(const TiXmlElement* root); |
---|
[7561] | 31 | |
---|
[7652] | 32 | virtual bool init(); |
---|
[7561] | 33 | |
---|
[7652] | 34 | virtual bool activate(); |
---|
| 35 | virtual bool deactivate(); |
---|
[7561] | 36 | |
---|
[7652] | 37 | virtual void tick(float dt); |
---|
[7646] | 38 | |
---|
[8255] | 39 | inline void activateRain() { this->activate(); } |
---|
| 40 | inline void deactivateRain() { this->deactivate(); } |
---|
| 41 | void startRaining(); |
---|
| 42 | |
---|
[7652] | 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; } |
---|
[7682] | 48 | inline void setRainWind(int force) { this->rainWindForce = force; } |
---|
[8255] | 49 | inline void setRainStart(float duration) { this->rainStartDuration = duration; } |
---|
[7561] | 50 | |
---|
[8255] | 51 | inline void setRainOption(const std::string& option) { |
---|
| 52 | if (option == "moverain") this->rainMove = true; |
---|
| 53 | if (option == "activate") this->rainActivate = true; |
---|
| 54 | } |
---|
[7577] | 55 | |
---|
[8255] | 56 | |
---|
[7652] | 57 | private: |
---|
[8255] | 58 | static SparkParticles* rainParticles; |
---|
| 59 | ParticleEmitter* emitter; |
---|
[7646] | 60 | |
---|
[8255] | 61 | float localTimer; |
---|
[7652] | 62 | |
---|
[8255] | 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 | |
---|
[7810] | 74 | OrxSound::SoundSource soundSource; |
---|
| 75 | OrxSound::SoundBuffer* rainBuffer; |
---|
| 76 | OrxSound::SoundBuffer* windBuffer; |
---|
[8255] | 77 | |
---|
| 78 | float soundRainVolume; |
---|
| 79 | |
---|
| 80 | LightManager* lightMan; |
---|
| 81 | GLfloat rainAmbient; |
---|
| 82 | |
---|
[7561] | 83 | }; |
---|
| 84 | |
---|
| 85 | #endif /* _RAIN_EFFECT */ |
---|