[7679] | 1 | /** |
---|
| 2 | * @file lightening_effect.h |
---|
| 3 | */ |
---|
| 4 | |
---|
| 5 | #ifndef _LIGHTENING_EFFECT |
---|
| 6 | #define _LIGHTENING_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 | |
---|
| 16 | |
---|
[8255] | 17 | class Billboard; |
---|
| 18 | class Light; |
---|
[7699] | 19 | |
---|
[7679] | 20 | class LighteningEffect : public WeatherEffect |
---|
| 21 | { |
---|
| 22 | public: |
---|
| 23 | LighteningEffect(const TiXmlElement* root = NULL); |
---|
| 24 | virtual ~LighteningEffect(); |
---|
| 25 | |
---|
| 26 | virtual void loadParams(const TiXmlElement* root); |
---|
| 27 | |
---|
| 28 | virtual bool init(); |
---|
| 29 | |
---|
| 30 | virtual bool activate(); |
---|
| 31 | virtual bool deactivate(); |
---|
| 32 | |
---|
[8255] | 33 | virtual void draw() const; |
---|
| 34 | virtual void tick(float dt); |
---|
| 35 | |
---|
| 36 | void coord(float x, float y, float z); |
---|
| 37 | void setFlashSize(float width, float height, float seedWidth, float seedHeight); |
---|
| 38 | |
---|
[8326] | 39 | inline void setLighteningOption(const std::string& option) { if (option == "activate") this->lighteningActivate = true; |
---|
| 40 | if (option == "movelightening") this->lighteningMove = true;} |
---|
[8269] | 41 | inline void setFlashFrequency(float mainFrequency, float seedTime) { this->mainFrequency = mainFrequency; |
---|
| 42 | this->flashFrequency = mainFrequency; |
---|
| 43 | this->seedTime = seedTime; } |
---|
[8255] | 44 | inline void setFlashConstTime(float flashConstTime) { this->flashConstTime = flashConstTime; } |
---|
| 45 | inline void setFlashRisingTime(float flashRisingTime) { if(flashRisingTime > this->flashConstTime) |
---|
| 46 | this->flashRisingTime = this->flashConstTime/2; |
---|
| 47 | else |
---|
| 48 | this->flashRisingTime = flashRisingTime; } |
---|
[8269] | 49 | inline void setFlashSeed(float seedX, float seedZ) { this->seedX = seedX; |
---|
| 50 | this->seedZ = seedZ; } |
---|
[7679] | 51 | |
---|
[8255] | 52 | void activateLightening() { this->activate(); } |
---|
| 53 | void deactivateLightening() { this->deactivate(); } |
---|
| 54 | |
---|
[7679] | 55 | private: |
---|
[8255] | 56 | Billboard* billboard[4]; |
---|
| 57 | bool lighteningActivate; |
---|
[8326] | 58 | bool lighteningMove; |
---|
[7679] | 59 | |
---|
[8255] | 60 | float flashFrequency; |
---|
[8266] | 61 | float mainFrequency; |
---|
[8255] | 62 | float flashConstTime; |
---|
| 63 | float flashRisingTime; |
---|
| 64 | |
---|
| 65 | float time; |
---|
| 66 | |
---|
| 67 | bool bNewCoordinate; |
---|
| 68 | float width; |
---|
| 69 | float height; |
---|
| 70 | float seedWidth; |
---|
| 71 | float seedHeight; |
---|
| 72 | |
---|
| 73 | float seedX; |
---|
| 74 | float seedZ; |
---|
| 75 | float seedTime; |
---|
| 76 | |
---|
| 77 | float mainPosX; |
---|
| 78 | float mainPosY; |
---|
| 79 | float mainPosZ; |
---|
[8326] | 80 | |
---|
| 81 | Vector cameraCoor; |
---|
[8255] | 82 | |
---|
| 83 | Light* flashLight; |
---|
| 84 | |
---|
| 85 | //OrxSound::SoundSource soundSource; |
---|
| 86 | //OrxSound::SoundBuffer* thunderBuffer; |
---|
| 87 | |
---|
[7679] | 88 | }; |
---|
| 89 | |
---|
| 90 | #endif /* _LIGHTENING_EFFECT */ |
---|