Last change
on this file since 8538 was
8495,
checked in by bensch, 18 years ago
|
merged the branche atmos back. no conflicts
|
File size:
1.8 KB
|
Rev | Line | |
---|
[6741] | 1 | /** |
---|
[7810] | 2 | * @file fog_effect.h |
---|
| 3 | */ |
---|
[6741] | 4 | |
---|
| 5 | #ifndef _FOG_EFFECT |
---|
| 6 | #define _FOG_EFFECT |
---|
| 7 | |
---|
| 8 | |
---|
[7810] | 9 | #include "weather_effect.h" |
---|
[8362] | 10 | #include "glincl.h" |
---|
[8495] | 11 | #include "vector.h" |
---|
[6741] | 12 | |
---|
[8495] | 13 | class FogEffect : public WeatherEffect { |
---|
| 14 | public: |
---|
| 15 | FogEffect(const TiXmlElement* root = NULL); |
---|
| 16 | virtual ~FogEffect(); |
---|
[8362] | 17 | |
---|
[8495] | 18 | virtual void loadParams(const TiXmlElement* root); |
---|
[6741] | 19 | |
---|
[8495] | 20 | virtual void init(); |
---|
[6741] | 21 | |
---|
[8495] | 22 | virtual void activate(); |
---|
| 23 | virtual void deactivate(); |
---|
[6741] | 24 | |
---|
[8495] | 25 | void activateFog() { |
---|
| 26 | this->activate(); |
---|
| 27 | } |
---|
| 28 | void deactivateFog() { |
---|
| 29 | this->deactivate(); |
---|
| 30 | } |
---|
[6772] | 31 | |
---|
[8495] | 32 | virtual void draw() const; |
---|
| 33 | virtual void tick(float dt); |
---|
[8255] | 34 | |
---|
[8495] | 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 | } |
---|
[8255] | 54 | |
---|
[8495] | 55 | inline void setFogOption(const std::string& option) { |
---|
| 56 | if (option == "activate") |
---|
| 57 | this->fogActivate = true; |
---|
| 58 | } |
---|
[6772] | 59 | |
---|
[8495] | 60 | void fadeInFog(); |
---|
| 61 | void fadeOutFog(); |
---|
[8255] | 62 | |
---|
[6772] | 63 | |
---|
[8495] | 64 | private: |
---|
| 65 | GLint stringToFogMode(const std::string& mode); |
---|
[8362] | 66 | |
---|
[8495] | 67 | bool fogActivate; |
---|
[8255] | 68 | |
---|
[8495] | 69 | bool fogFadeInActivate; |
---|
| 70 | bool fogFadeOutActivate; |
---|
| 71 | |
---|
| 72 | GLfloat fogFadeInDuration; |
---|
| 73 | GLfloat fogFadeOutDuration; |
---|
| 74 | |
---|
| 75 | float localTimer; |
---|
| 76 | |
---|
| 77 | GLint fogMode; |
---|
| 78 | GLfloat fogDensity; |
---|
| 79 | GLfloat fogFadeDensity; |
---|
| 80 | |
---|
| 81 | GLfloat fogStart; |
---|
| 82 | GLfloat fogEnd; |
---|
| 83 | Vector colorVector; |
---|
[6741] | 84 | }; |
---|
| 85 | |
---|
| 86 | |
---|
[7810] | 87 | #endif /* _FOG_EFFECT */ |
---|
Note: See
TracBrowser
for help on using the repository browser.