Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

atmospheric: fog - weird fade problems, not solved

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