Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/proxy/src/lib/graphics/effects/lightning_effect.h @ 9638

Last change on this file since 9638 was 9006, checked in by bensch, 18 years ago

orxonox/trunk: merged the mountain_lake branche back to the trunk
merged with command:
svn merge -r8799:HEAD https://svn.orxonox.net/orxonox/branches/mountain_lake .

conflicts in script taken from the branche, since they are indentation-problems.

also fixed the delete-bug for the lightning-effect

File size: 2.4 KB
Line 
1/**
2* @file lightning_effect.h
3*/
4
5#ifndef _LIGHTNING_EFFECT
6#define _LIGHTNING_EFFECT
7
8#include "vector.h"
9#include "vector2D.h"
10
11#include "weather_effect.h"
12
13#include "sound_buffer.h"
14#include "sound_source.h"
15
16class Billboard;
17class Light;
18
19class LightningEffect : public WeatherEffect {
20public:
21    LightningEffect(const TiXmlElement* root = NULL);
22    virtual ~LightningEffect();
23
24    virtual void loadParams(const TiXmlElement* root);
25
26    virtual void init();
27
28    virtual void activate();
29    virtual void deactivate();
30
31    inline  void activateLightning() {
32        this->activate();
33    }
34    inline  void deactivateLightning() {
35        this->deactivate();
36    }
37
38    virtual void tick(float dt);
39
40    void coord(float x, float y, float z);
41    void setFlashSize(float width, float height, float seedWidth, float seedHeight);
42
43    inline void setLightningOption(const std::string& option) {
44        if (option == "activate")
45            this->lightningActivate = true;
46        if (option == "movelightning")
47            this->lightningMove = true;
48    }
49
50    inline void setFlashFrequency(float baseFrequency, float seedTime) {
51        this->flashFrequencyBase = baseFrequency;
52        this->flashFrequency = baseFrequency;
53        this->flashFrequencySeed = seedTime;
54    }
55
56    inline void setFlashConstTime(float holdTime) {
57        this->flashHoldTime = holdTime;
58    }
59
60    inline void setFlashRisingTime(float flashRisingTime) {
61        if(flashRisingTime > this->flashHoldTime)
62            this->flashRisingTime = this->flashHoldTime * 0.5;
63        else
64            this->flashRisingTime = flashRisingTime;
65    }
66
67    inline void setFlashSeed(float seedX, float seedZ) {
68        this->seedX = seedX;
69        this->seedZ = seedZ;
70    }
71
72
73private:
74
75    void newCoordinates();
76    void setTexture();
77    void switchTexture();
78
79    Billboard* thunderBolt[4];
80    bool thunderTextureA;
81
82    bool lightningActivate;
83    bool lightningMove;
84
85    float flashFrequency;
86    float flashFrequencyBase;
87    float flashHoldTime;
88    float flashRisingTime;
89
90    float time;
91
92    float width;
93    float height;
94    float seedWidth;
95    float seedHeight;
96
97    float seedX;
98    float seedZ;
99    float flashFrequencySeed;
100
101    float mainPosX;
102    float mainPosY;
103    float mainPosZ;
104
105    Vector origSkyColor;
106    Vector cameraCoor;
107
108    Light* flashLight;
109
110    OrxSound::SoundSource    soundSource;
111    OrxSound::SoundBuffer*   thunderBuffer;
112
113};
114
115#endif  /* _LIGHTNING_EFFECT */
Note: See TracBrowser for help on using the repository browser.