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