Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jun 26, 2006, 3:36:16 PM (18 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/fog_effect.h

    r8495 r8793  
    11/**
    2 * @file fog_effect.h
     2 * @file fog_effect.h
     3 * Generates simple openGL fog
    34*/
    45
     
    67#define _FOG_EFFECT
    78
    8 
    99#include "weather_effect.h"
    1010#include "glincl.h"
    1111#include "vector.h"
    1212
    13 class FogEffect : public WeatherEffect {
     13class FogEffect : public WeatherEffect
     14{
    1415public:
    15     FogEffect(const TiXmlElement* root = NULL);
    16     virtual ~FogEffect();
     16  FogEffect(const TiXmlElement* root = NULL);
     17  virtual ~FogEffect();
    1718
    18     virtual void loadParams(const TiXmlElement* root);
     19  virtual void loadParams(const TiXmlElement* root);
    1920
    20     virtual void init();
     21  virtual void init();
    2122
    22     virtual void activate();
    23     virtual void deactivate();
     23  virtual void activate();
     24  virtual void deactivate();
    2425
    25     void activateFog() {
    26         this->activate();
    27     }
    28     void deactivateFog() {
    29         this->deactivate();
    30     }
     26  void activateFog()
     27  {
     28    this->activate();
     29  }
    3130
    32     virtual void draw() const;
    33     virtual void tick(float dt);
     31  void deactivateFog()
     32  {
     33    this->deactivate();
     34  }
    3435
    35     inline void setFogMode(const std::string& mode) {
    36         this->fogMode = this->stringToFogMode(mode);
    37     }
    38     inline void setFogDensity(float density) {
    39         this->fogDensity = density;
    40     }
    41     inline void setFogRange(float start, float end) {
    42         this->fogStart = start;
    43         this->fogEnd = end;
    44     }
    45     inline void setFogColor(float r, float g, float b) {
    46         this->colorVector = Vector(r, g, b);
    47     }
    48     inline void setFogFadeIn(float fadein) {
    49         this->fogFadeInDuration = fadein;
    50     }
    51     inline void setFogFadeOut(float fadeout) {
    52         this->fogFadeOutDuration = fadeout;
    53     }
     36  virtual void draw() const;
     37  virtual void tick(float dt);
    5438
    55     inline void setFogOption(const std::string& option) {
    56         if (option == "activate")
    57             this->fogActivate = true;
    58     }
     39  inline void setFogMode(const std::string& mode)
     40  {
     41    this->fogMode = this->stringToFogMode(mode);
     42  }
    5943
    60     void fadeInFog();
    61     void fadeOutFog();
     44  inline void setFogDensity(float density)
     45  {
     46    this->fogDensity = density;
     47  }
     48
     49  inline void setFogRange(float start, float end)
     50  {
     51    this->fogStart = start;
     52    this->fogEnd = end;
     53  }
     54
     55  inline void setFogColor(float r, float g, float b)
     56  {
     57    this->colorVector = Vector(r, g, b);
     58  }
     59
     60  inline void setFogFadeIn(float fadein)
     61  {
     62    this->fogFadeInDuration = fadein;
     63  }
     64
     65  inline void setFogFadeOut(float fadeout)
     66  {
     67    this->fogFadeOutDuration = fadeout;
     68  }
     69
     70  inline void setFogOption(const std::string& option)
     71  {
     72    if (option == "activate")
     73      this->fogActivate = true;
     74  }
     75
     76  void fadeInFog();
     77  void fadeOutFog();
    6278
    6379
    6480private:
    65     GLint stringToFogMode(const std::string& mode);
     81  inline GLint stringToFogMode(const std::string& mode)
     82  {
     83    if(mode == "GL_LINEAR")
     84      return GL_LINEAR;
     85    else if(mode == "GL_EXP")
     86      return GL_EXP;
     87    else if(mode == "GL_EXP2" )
     88      return GL_EXP2;
     89    else
     90      return -1;
     91  }
    6692
    67     bool          fogActivate;
     93  bool          fogActivate;
    6894
    69     bool          fogFadeInActivate;
    70     bool          fogFadeOutActivate;
     95  bool          fogFadeInActivate;
     96  bool          fogFadeOutActivate;
    7197
    72     GLfloat       fogFadeInDuration;
    73     GLfloat       fogFadeOutDuration;
     98  GLfloat       fogFadeInDuration;
     99  GLfloat       fogFadeOutDuration;
    74100
    75     float         localTimer;
     101  GLint         fogMode;
     102  GLfloat       fogDensity;
     103  GLfloat       fogFadeDensity;
    76104
    77     GLint         fogMode;
    78     GLfloat       fogDensity;
    79     GLfloat       fogFadeDensity;
     105  GLfloat       fogStart;
     106  GLfloat       fogEnd;
     107  GLfloat       fogFadeEnd;
    80108
    81     GLfloat       fogStart;
    82     GLfloat       fogEnd;
    83     Vector        colorVector;
     109  Vector        colorVector;
     110  float         localTimer;
    84111};
    85112
    86 
    87113#endif  /* _FOG_EFFECT */
Note: See TracChangeset for help on using the changeset viewer.