Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 24, 2006, 3:35:07 PM (19 years ago)
Author:
amaechler
Message:

branches/atmospheric_engine: rainsound fade working and comments

File:
1 edited

Legend:

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

    r8521 r8771  
    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"
     
    1619class LightManager;
    1720
    18 #include "weather_effect.h"
    19 
    2021#include "sound_buffer.h"
    2122#include "sound_source.h"
    2223
     24class RainEffect : public WeatherEffect
     25{
     26public:
     27  RainEffect(const TiXmlElement* root = NULL);
     28  virtual ~RainEffect();
    2329
    24 class RainEffect : public WeatherEffect {
    25 public:
    26     RainEffect(const TiXmlElement* root = NULL);
    27     virtual ~RainEffect();
     30  virtual void loadParams(const TiXmlElement* root);
    2831
    29     virtual void loadParams(const TiXmlElement* root);
     32  virtual void init();
    3033
    31     virtual void init();
     34  virtual void activate();
     35  virtual void deactivate();
    3236
    33     virtual void activate();
    34     virtual void deactivate();
     37  inline void activateRain()
     38  {
     39    this->activate();
     40  }
    3541
    36     inline void activateRain() {
    37         this->activate();
    38     }
     42  inline void deactivateRain()
     43  {
     44    this->deactivate();
     45  }
    3946
    40     inline void deactivateRain() {
    41         this->deactivate();
    42     }
     47  virtual void tick(float dt);
    4348
    44     virtual void tick(float dt);
     49  void startRaining();
     50  void stopRaining();
    4551
    46     void startRaining();
    47     void stopRaining();
     52  void hideRain();
    4853
    49     void hideRain();
     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  }
    5078
    51     inline void setRainCoord(float x, float y, float z) {
    52         this->rainCoord = Vector(x, y, z);
    53     }
    54     inline void setRainSize(float x, float y) {
    55         this->rainSize = Vector2D(x, y);
    56     }
    57     inline void setRainRate(float rate) {
    58         this->rainRate = rate;
    59     }
    60     inline void setRainVelocity(float velocity) {
    61         this->rainVelocity = -velocity;
    62     }
    63     inline void setRainLife(float life) {
    64         this->rainLife = life;
    65     }
    66     inline void setRainWind(int force) {
    67         this->rainWindForce = force;
    68     }
     79  inline void setRainFadeIn(float fadein)
     80  {
     81    this->rainFadeInDuration = fadein;
     82  }
     83  inline void setRainFadeOut(float fadeout)
     84  {
     85    this->rainFadeOutDuration = fadeout;
     86  }
    6987
    70     inline void setRainFadeIn(float fadein) {
    71         this->rainFadeInDuration = fadein;
    72     }
    73     inline void setRainFadeOut(float fadeout) {
    74         this->rainFadeOutDuration = fadeout;
    75     }
    76 
    77     inline void setRainOption(const std::string& option) {
    78         if (option == "moverain")
    79             this->rainMove = true;
    80         if (option == "activate")
    81             this->rainActivate = true;
    82     }
     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  }
    8395
    8496
    8597private:
    86     static SparkParticles*      rainParticles;
    87     ParticleEmitter*            emitter;
     98  static SparkParticles*      rainParticles;
     99  ParticleEmitter*            emitter;
    88100
    89     GLfloat                     rainFadeInDuration;
    90     GLfloat                     rainFadeOutDuration;
    91     float                       localTimer;
     101  float                       localTimer;
    92102
    93     Vector                      rainCoord;
    94     Vector2D                    rainSize;
    95     GLfloat                     rainRate;
    96     GLfloat                     rainVelocity;
    97     GLfloat                     rainLife;
    98     GLfloat                     rainMaxParticles;
    99     int                         rainWindForce;
    100     bool                        rainMove;
    101     bool                        rainActivate;
     103  GLfloat                     rainFadeInDuration;
     104  GLfloat                     rainFadeOutDuration;
    102105
    103     OrxSound::SoundSource       soundSource;
    104     OrxSound::SoundBuffer*      rainBuffer;
    105     OrxSound::SoundBuffer*      windBuffer;
     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;
    106115
    107     float                       soundRainVolume;
     116  OrxSound::SoundSource       soundSource;
     117  OrxSound::SoundBuffer*      rainBuffer;
     118  OrxSound::SoundBuffer*      windBuffer;
    108119
    109     LightManager*               lightMan;
    110     GLfloat                     rainAmbient;
     120  float                       soundRainVolume;
     121
     122  LightManager*               lightMan;
     123  GLfloat                     rainAmbient;
    111124
    112125};
Note: See TracChangeset for help on using the changeset viewer.