Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/weather_effects/fog_effect.h @ 10210

Last change on this file since 10210 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 2.4 KB
RevLine 
[6741]1/**
[8793]2 * @file fog_effect.h
3 * Generates simple openGL fog
[7810]4*/
[6741]5
6#ifndef _FOG_EFFECT
7#define _FOG_EFFECT
8
[7810]9#include "weather_effect.h"
[8362]10#include "glincl.h"
[8495]11#include "vector.h"
[6741]12
[9235]13class CloudEffect;
14
[8793]15class FogEffect : public WeatherEffect
16{
[9715]17  ObjectListDeclaration(FogEffect);
[8495]18public:
[8793]19  FogEffect(const TiXmlElement* root = NULL);
20  virtual ~FogEffect();
[8362]21
[8793]22  virtual void loadParams(const TiXmlElement* root);
[6741]23
[8793]24  virtual void init();
[6741]25
[8793]26  virtual void activate();
27  virtual void deactivate();
[6741]28
[8793]29  void activateFog()
30  {
31    this->activate();
32  }
[6772]33
[8793]34  void deactivateFog()
35  {
36    this->deactivate();
37  }
[8255]38
[8793]39  virtual void draw() const;
40  virtual void tick(float dt);
[8255]41
[8793]42  inline void setFogMode(const std::string& mode)
43  {
44    this->fogMode = this->stringToFogMode(mode);
45  }
[6772]46
[8793]47  inline void setFogDensity(float density)
48  {
49    this->fogDensity = density;
50  }
[8255]51
[8793]52  inline void setFogRange(float start, float end)
53  {
54    this->fogStart = start;
55    this->fogEnd = end;
56  }
[6772]57
[8793]58  inline void setFogColor(float r, float g, float b)
59  {
60    this->colorVector = Vector(r, g, b);
61  }
62
63  inline void setFogFadeIn(float fadein)
64  {
65    this->fogFadeInDuration = fadein;
66  }
67
68  inline void setFogFadeOut(float fadeout)
69  {
70    this->fogFadeOutDuration = fadeout;
71  }
72
73  inline void setFogOption(const std::string& option)
74  {
75    if (option == "activate")
76      this->fogActivate = true;
77  }
[9686]78
[9235]79  inline void setCloudColor(float colorX, float colorY, float colorZ)
80  {
81    this->cloudColor = Vector(colorX, colorY, colorZ);
82  }
83  inline void setSkyColor(float colorX, float colorY, float colorZ)
84  {
85    this->skyColor = Vector(colorX, colorY, colorZ);
86  }
[8793]87
88  void fadeInFog();
89  void fadeOutFog();
90
91
[8495]92private:
[8793]93  inline GLint stringToFogMode(const std::string& mode)
94  {
95    if(mode == "GL_LINEAR")
96      return GL_LINEAR;
97    else if(mode == "GL_EXP")
98      return GL_EXP;
99    else if(mode == "GL_EXP2" )
100      return GL_EXP2;
101    else
102      return -1;
103  }
[8362]104
[8793]105  bool          fogActivate;
[8255]106
[8793]107  bool          fogFadeInActivate;
108  bool          fogFadeOutActivate;
[8495]109
[8793]110  GLfloat       fogFadeInDuration;
111  GLfloat       fogFadeOutDuration;
[8495]112
[8793]113  GLint         fogMode;
114  GLfloat       fogDensity;
115  GLfloat       fogFadeDensity;
[8495]116
[8793]117  GLfloat       fogStart;
118  GLfloat       fogEnd;
119  GLfloat       fogFadeEnd;
[8495]120
[8793]121  Vector        colorVector;
[9686]122  float         localTimer;
123
[9235]124  Vector oldSkyColor;
125  Vector oldCloudColor;
126  Vector skyColor;
127  Vector cloudColor;
[6741]128};
129
[7810]130#endif  /* _FOG_EFFECT */
Note: See TracBrowser for help on using the repository browser.