Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/effects/rain_effect.h @ 8751

Last change on this file since 8751 was 8495, checked in by bensch, 18 years ago

merged the branche atmos back. no conflicts

File size: 2.5 KB
Line 
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
14class SparkParticles;
15class PlainEmitter;
16class LightManager;
17
18#include "weather_effect.h"
19
20#include "sound_buffer.h"
21#include "sound_source.h"
22
23
24class RainEffect : public WeatherEffect {
25public:
26    RainEffect(const TiXmlElement* root = NULL);
27    virtual ~RainEffect();
28
29    virtual void loadParams(const TiXmlElement* root);
30
31    virtual void init();
32
33    virtual void activate();
34    virtual void deactivate();
35
36    inline void activateRain() {
37        this->activate();
38    }
39    inline void deactivateRain() {
40        this->deactivate();
41    }
42
43    virtual void tick(float dt);
44
45    void startRaining();
46    void stopRaining();
47
48    inline void setRainCoord(float x, float y, float z) {
49        this->rainCoord = Vector(x, y, z);
50    }
51    inline void setRainSize(float x, float y) {
52        this->rainSize = Vector2D(x, y);
53    }
54    inline void setRainRate(float rate) {
55        this->rainRate = rate;
56    }
57    inline void setRainVelocity(float velocity) {
58        this->rainVelocity = -velocity;
59    }
60    inline void setRainLife(float life) {
61        this->rainLife = life;
62    }
63    inline void setRainWind(int force) {
64        this->rainWindForce = force;
65    }
66
67    inline void setRainFadeIn(float fadein) {
68        this->rainFadeInDuration = fadein;
69    }
70    inline void setRainFadeOut(float fadeout) {
71        this->rainFadeOutDuration = fadeout;
72    }
73
74    inline void setRainOption(const std::string& option) {
75        if (option == "moverain")
76            this->rainMove = true;
77        if (option == "activate")
78            this->rainActivate = true;
79    }
80
81
82private:
83    static SparkParticles*      rainParticles;
84    ParticleEmitter*            emitter;
85
86    GLfloat         rainFadeInDuration;
87    GLfloat         rainFadeOutDuration;
88    float           localTimer;
89
90    Vector          rainCoord;
91    Vector2D        rainSize;
92    GLfloat         rainRate;
93    GLfloat         rainVelocity;
94    GLfloat         rainLife;
95    GLfloat         rainMaxParticles;
96    int             rainWindForce;
97    bool            rainMove;
98    bool            rainActivate;
99
100    OrxSound::SoundSource     soundSource;
101    OrxSound::SoundBuffer*      rainBuffer;
102    OrxSound::SoundBuffer*      windBuffer;
103
104    float         soundRainVolume;
105
106    LightManager*       lightMan;
107    GLfloat         rainAmbient;
108
109};
110
111#endif  /* _RAIN_EFFECT */
Note: See TracBrowser for help on using the repository browser.