Changeset 8793 in orxonox.OLD for trunk/src/lib/graphics/effects/fog_effect.h
- Timestamp:
- Jun 26, 2006, 3:36:16 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/effects/fog_effect.h
r8495 r8793 1 1 /** 2 * @file fog_effect.h 2 * @file fog_effect.h 3 * Generates simple openGL fog 3 4 */ 4 5 … … 6 7 #define _FOG_EFFECT 7 8 8 9 9 #include "weather_effect.h" 10 10 #include "glincl.h" 11 11 #include "vector.h" 12 12 13 class FogEffect : public WeatherEffect { 13 class FogEffect : public WeatherEffect 14 { 14 15 public: 15 16 16 FogEffect(const TiXmlElement* root = NULL); 17 virtual ~FogEffect(); 17 18 18 19 virtual void loadParams(const TiXmlElement* root); 19 20 20 21 virtual void init(); 21 22 22 23 23 virtual void activate(); 24 virtual void deactivate(); 24 25 25 void activateFog() { 26 this->activate(); 27 } 28 void deactivateFog() { 29 this->deactivate(); 30 } 26 void activateFog() 27 { 28 this->activate(); 29 } 31 30 32 virtual void draw() const; 33 virtual void tick(float dt); 31 void deactivateFog() 32 { 33 this->deactivate(); 34 } 34 35 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); 54 38 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 } 59 43 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(); 62 78 63 79 64 80 private: 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 } 66 92 67 93 bool fogActivate; 68 94 69 70 95 bool fogFadeInActivate; 96 bool fogFadeOutActivate; 71 97 72 73 98 GLfloat fogFadeInDuration; 99 GLfloat fogFadeOutDuration; 74 100 75 float localTimer; 101 GLint fogMode; 102 GLfloat fogDensity; 103 GLfloat fogFadeDensity; 76 104 77 GLint fogMode;78 GLfloat fogDensity;79 GLfloat fogFadeDensity;105 GLfloat fogStart; 106 GLfloat fogEnd; 107 GLfloat fogFadeEnd; 80 108 81 GLfloat fogStart; 82 GLfloat fogEnd; 83 Vector colorVector; 109 Vector colorVector; 110 float localTimer; 84 111 }; 85 112 86 87 113 #endif /* _FOG_EFFECT */
Note: See TracChangeset
for help on using the changeset viewer.