Changeset 8771 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h
- Timestamp:
- Jun 24, 2006, 3:35:07 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h
r8716 r8771 1 1 /** 2 * @file fog_effect.h 2 * @file fog_effect.h 3 * Generates simple openGL fog 3 4 */ 4 5 … … 10 11 #include "vector.h" 11 12 12 class FogEffect : public WeatherEffect { 13 class FogEffect : public WeatherEffect 14 { 13 15 public: 14 15 16 FogEffect(const TiXmlElement* root = NULL); 17 virtual ~FogEffect(); 16 18 17 19 virtual void loadParams(const TiXmlElement* root); 18 20 19 21 virtual void init(); 20 22 21 22 23 virtual void activate(); 24 virtual void deactivate(); 23 25 24 void activateFog() { 25 this->activate(); 26 } 27 void deactivateFog() { 28 this->deactivate(); 29 } 26 void activateFog() 27 { 28 this->activate(); 29 } 30 30 31 virtual void draw() const; 32 virtual void tick(float dt); 31 void deactivateFog() 32 { 33 this->deactivate(); 34 } 33 35 34 inline void setFogMode(const std::string& mode) { 35 this->fogMode = this->stringToFogMode(mode); 36 } 37 inline void setFogDensity(float density) { 38 this->fogDensity = density; 39 } 40 inline void setFogRange(float start, float end) { 41 this->fogStart = start; 42 this->fogEnd = end; 43 } 44 inline void setFogColor(float r, float g, float b) { 45 this->colorVector = Vector(r, g, b); 46 } 47 inline void setFogFadeIn(float fadein) { 48 this->fogFadeInDuration = fadein; 49 } 50 inline void setFogFadeOut(float fadeout) { 51 this->fogFadeOutDuration = fadeout; 52 } 36 virtual void draw() const; 37 virtual void tick(float dt); 53 38 54 inline void setFogOption(const std::string& option) {55 if (option == "activate")56 this->fogActivate = true;57 39 inline void setFogMode(const std::string& mode) 40 { 41 this->fogMode = this->stringToFogMode(mode); 42 } 58 43 59 void fadeInFog(); 60 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(); 61 78 62 79 63 80 private: 64 inline GLint stringToFogMode(const std::string& mode) { 65 if(mode == "GL_LINEAR") 66 return GL_LINEAR; 67 else if(mode == "GL_EXP") 68 return GL_EXP; 69 else if(mode == "GL_EXP2" ) 70 return GL_EXP2; 71 else 72 return -1; 73 } 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 } 74 92 75 93 bool fogActivate; 76 94 77 78 95 bool fogFadeInActivate; 96 bool fogFadeOutActivate; 79 97 80 81 98 GLfloat fogFadeInDuration; 99 GLfloat fogFadeOutDuration; 82 100 83 float localTimer; 101 GLint fogMode; 102 GLfloat fogDensity; 103 GLfloat fogFadeDensity; 84 104 85 GLint fogMode;86 GLfloat fogDensity;87 GLfloat fogFadeDensity;105 GLfloat fogStart; 106 GLfloat fogEnd; 107 GLfloat fogFadeEnd; 88 108 89 GLfloat fogStart; 90 GLfloat fogEnd; 91 GLfloat fogFadeEnd; 92 93 Vector colorVector; 109 Vector colorVector; 110 float localTimer; 94 111 }; 95 112 96 97 113 #endif /* _FOG_EFFECT */
Note: See TracChangeset
for help on using the changeset viewer.