Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h @ 8636

Last change on this file since 8636 was 8521, checked in by amaechler, 18 years ago


File size: 2.1 KB
Line 
1/**
2* @file fog_effect.h
3*/
4
5#ifndef _FOG_EFFECT
6#define _FOG_EFFECT
7
8
9#include "weather_effect.h"
10#include "glincl.h"
11#include "vector.h"
12
13class FogEffect : public WeatherEffect {
14public:
15    FogEffect(const TiXmlElement* root = NULL);
16    virtual ~FogEffect();
17
18    virtual void loadParams(const TiXmlElement* root);
19
20    virtual void init();
21
22    virtual void activate();
23    virtual void deactivate();
24
25    void activateFog() {
26        this->activate();
27    }
28    void deactivateFog() {
29        this->deactivate();
30    }
31
32    virtual void draw() const;
33    virtual void tick(float dt);
34
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    }
54
55    inline void setFogOption(const std::string& option) {
56        if (option == "activate")
57            this->fogActivate = true;
58    }
59
60    void fadeInFog();
61    void fadeOutFog();
62
63
64private:
65    inline GLint stringToFogMode(const std::string& mode) {
66        if(mode == "GL_LINEAR")
67            return GL_LINEAR;
68        else if(mode == "GL_EXP")
69            return GL_EXP;
70        else if(mode == "GL_EXP2" )
71            return GL_EXP2;
72        else
73            return -1;
74    }
75
76    bool          fogActivate;
77
78    bool          fogFadeInActivate;
79    bool          fogFadeOutActivate;
80
81    GLfloat       fogFadeInDuration;
82    GLfloat       fogFadeOutDuration;
83
84    float         localTimer;
85
86    GLint         fogMode;
87    GLfloat       fogDensity;
88    GLfloat       fogFadeDensity;
89
90    GLfloat       fogStart;
91    GLfloat       fogEnd;
92    Vector        colorVector;
93};
94
95
96#endif  /* _FOG_EFFECT */
Note: See TracBrowser for help on using the repository browser.