/** * @file rain_effect.h */ #ifndef _RAIN_EFFECT #define _RAIN_EFFECT #include "vector.h" #include "vector2D.h" #include #include "particle_system.h" class SparkParticles; class PlainEmitter; class LightManager; #include "weather_effect.h" #include "sound_buffer.h" #include "sound_source.h" class RainEffect : public WeatherEffect { public: RainEffect(const TiXmlElement* root = NULL); virtual ~RainEffect(); virtual void loadParams(const TiXmlElement* root); virtual void init(); virtual void activate(); virtual void deactivate(); inline void activateRain() { this->activate(); } inline void deactivateRain() { this->deactivate(); } virtual void tick(float dt); void startRaining(); void stopRaining(); inline void setRainCoord(float x, float y, float z) { this->rainCoord = Vector(x, y, z); } inline void setRainSize(float x, float y) { this->rainSize = Vector2D(x, y); } inline void setRainRate(float rate) { this->rainRate = rate; } inline void setRainVelocity(float velocity) { this->rainVelocity = -velocity; } inline void setRainLife(float life) { this->rainLife = life; } inline void setRainWind(int force) { this->rainWindForce = force; } inline void setRainFadeIn(float fadein) { this->rainFadeInDuration = fadein; } inline void setRainFadeOut(float fadeout) { this->rainFadeOutDuration = fadeout; } inline void setRainOption(const std::string& option) { if (option == "moverain") this->rainMove = true; if (option == "activate") this->rainActivate = true; } private: static SparkParticles* rainParticles; ParticleEmitter* emitter; GLfloat rainFadeInDuration; GLfloat rainFadeOutDuration; float localTimer; Vector rainCoord; Vector2D rainSize; GLfloat rainRate; GLfloat rainVelocity; GLfloat rainLife; GLfloat rainMaxParticles; int rainWindForce; bool rainMove; bool rainActivate; OrxSound::SoundSource soundSource; OrxSound::SoundBuffer* rainBuffer; OrxSound::SoundBuffer* windBuffer; float soundRainVolume; LightManager* lightMan; GLfloat rainAmbient; }; #endif /* _RAIN_EFFECT */