Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8793 in orxonox.OLD for trunk/src/lib/graphics/effects/rain_effect.h


Ignore:
Timestamp:
Jun 26, 2006, 3:36:16 PM (19 years ago)
Author:
patrick
Message:

trunk: merged the weather engine branche to the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/effects/rain_effect.h

    r8495 r8793  
    11/**
    2 * @file rain_effect.h
     2 * @file rain_effect.h
     3 * Generates rain using the particle engine
    34*/
    45
    56#ifndef _RAIN_EFFECT
    67#define _RAIN_EFFECT
     8
     9#include "weather_effect.h"
    710
    811#include "vector.h"
     
    1518class PlainEmitter;
    1619class LightManager;
    17 
    18 #include "weather_effect.h"
     20class CloudEffect;
    1921
    2022#include "sound_buffer.h"
    2123#include "sound_source.h"
    2224
     25class RainEffect : public WeatherEffect
     26{
     27public:
     28  RainEffect(const TiXmlElement* root = NULL);
     29  virtual ~RainEffect();
    2330
    24 class RainEffect : public WeatherEffect {
    25 public:
    26     RainEffect(const TiXmlElement* root = NULL);
    27     virtual ~RainEffect();
     31  virtual void loadParams(const TiXmlElement* root);
    2832
    29     virtual void loadParams(const TiXmlElement* root);
     33  virtual void init();
    3034
    31     virtual void init();
     35  virtual void activate();
     36  virtual void deactivate();
    3237
    33     virtual void activate();
    34     virtual void deactivate();
     38  inline void activateRain()
     39  {
     40    this->activate();
     41  }
    3542
    36     inline void activateRain() {
    37         this->activate();
    38     }
    39     inline void deactivateRain() {
    40         this->deactivate();
    41     }
     43  inline void deactivateRain()
     44  {
     45    this->deactivate();
     46  }
    4247
    43     virtual void tick(float dt);
     48  virtual void tick(float dt);
    4449
    45     void startRaining();
    46     void stopRaining();
     50  void startRaining();
     51  void stopRaining();
    4752
    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     }
     53  void hideRain();
    6654
    67     inline void setRainFadeIn(float fadein) {
    68         this->rainFadeInDuration = fadein;
    69     }
    70     inline void setRainFadeOut(float fadeout) {
    71         this->rainFadeOutDuration = fadeout;
    72     }
     55  inline void setRainCoord(float x, float y, float z)
     56  {
     57    this->rainCoord = Vector(x, y, z);
     58  }
     59  inline void setRainSize(float x, float y)
     60  {
     61    this->rainSize = Vector2D(x, y);
     62  }
     63  inline void setRainRate(float rate)
     64  {
     65    this->rainRate = rate;
     66  }
     67  inline void setRainVelocity(float velocity)
     68  {
     69    this->rainVelocity = -velocity;
     70  }
     71  inline void setRainLife(float life)
     72  {
     73    this->rainLife = life;
     74  }
     75  inline void setRainWind(int force)
     76  {
     77    this->rainWindForce = force;
     78  }
    7379
    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  inline void setRainFadeIn(float fadein)
     81  {
     82    this->rainFadeInDuration = fadein;
     83  }
     84  inline void setRainFadeOut(float fadeout)
     85  {
     86    this->rainFadeOutDuration = fadeout;
     87  }
     88 
     89  inline void setCloudColor(float colorX, float colorY, float colorZ)
     90  {
     91    this->cloudColor = Vector(colorX, colorY, colorZ);
     92  }
     93  inline void setSkyColor(float colorX, float colorY, float colorZ)
     94  {
     95    this->skyColor = Vector(colorX, colorY, colorZ);
     96  }
     97
     98  inline void setRainOption(const std::string& option)
     99  {
     100    if (option == "moverain")
     101      this->rainMove = true;
     102    if (option == "activate")
     103      this->rainActivate = true;
     104  }
    80105
    81106
    82107private:
    83     static SparkParticles*      rainParticles;
    84     ParticleEmitter*            emitter;
     108  static SparkParticles*      rainParticles;
     109  ParticleEmitter*            emitter;
    85110
    86     GLfloat         rainFadeInDuration;
    87     GLfloat         rainFadeOutDuration;
    88     float           localTimer;
     111  float                       localTimer;
    89112
    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;
     113  GLfloat                     rainFadeInDuration;
     114  GLfloat                     rainFadeOutDuration;
    99115
    100     OrxSound::SoundSource     soundSource;
    101     OrxSound::SoundBuffer*      rainBuffer;
    102     OrxSound::SoundBuffer*      windBuffer;
     116  Vector                      rainCoord;
     117  Vector2D                    rainSize;
     118  GLfloat                     rainRate;
     119  GLfloat                     rainVelocity;
     120  GLfloat                     rainLife;
     121  GLfloat                     rainMaxParticles;
     122  int                         rainWindForce;
     123  bool                        rainMove;
     124  bool                        rainActivate;
    103125
    104     float         soundRainVolume;
     126  OrxSound::SoundSource       soundSource;
     127  OrxSound::SoundBuffer*      rainBuffer;
     128  OrxSound::SoundBuffer*      windBuffer;
    105129
    106     LightManager*       lightMan;
    107     GLfloat         rainAmbient;
     130  float                       soundRainVolume;
     131
     132  LightManager*               lightMan;
     133  GLfloat                     rainAmbient;
     134 
     135  Vector oldSkyColor;
     136  Vector oldCloudColor;
     137  Vector skyColor;
     138  Vector cloudColor;
    108139
    109140};
Note: See TracChangeset for help on using the changeset viewer.