Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.h @ 8781

Last change on this file since 8781 was 8771, checked in by amaechler, 19 years ago

branches/atmospheric_engine: rainsound fade working and comments

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