| [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 draw() const; | 
|---|
 | 36 |                 virtual void tick(float dt); | 
|---|
 | 37 |                  | 
|---|
 | 38 |                 void coord(float x, float y, float z); | 
|---|
 | 39 |                 void setFlashSize(float width, float height, float seedWidth, float seedHeight); | 
|---|
 | 40 |                  | 
|---|
 | 41 |                 inline void setLighteningOption(const std::string& option) { | 
|---|
 | 42 |                         if (option == "activate") this->lighteningActivate = true; | 
|---|
 | 43 |                         if (option == "movelightening") this->lighteningMove = true; | 
|---|
 | 44 |                 } | 
|---|
| [7679] | 45 |  | 
|---|
| [8495] | 46 |                 inline void setFlashFrequency(float mainFrequency, float seedTime) { | 
|---|
 | 47 |                         this->mainFrequency = mainFrequency; | 
|---|
 | 48 |                         this->flashFrequency = mainFrequency; | 
|---|
 | 49 |                         this->seedTime = seedTime; | 
|---|
 | 50 |                 } | 
|---|
 | 51 |                  | 
|---|
 | 52 |                 inline void setFlashConstTime(float flashConstTime) { this->flashConstTime = flashConstTime; } | 
|---|
| [8255] | 53 |  | 
|---|
| [8495] | 54 |                 inline void setFlashRisingTime(float flashRisingTime) { | 
|---|
 | 55 |                         if(flashRisingTime > this->flashConstTime) | 
|---|
 | 56 |                                 this->flashRisingTime = this->flashConstTime/2; | 
|---|
 | 57 |                         else | 
|---|
 | 58 |                                 this->flashRisingTime = flashRisingTime; | 
|---|
 | 59 |                 } | 
|---|
 | 60 |                  | 
|---|
 | 61 |                 inline void setFlashSeed(float seedX, float seedZ) { | 
|---|
 | 62 |                         this->seedX = seedX; | 
|---|
 | 63 |                         this->seedZ = seedZ; | 
|---|
 | 64 |                 } | 
|---|
 | 65 |                  | 
|---|
| [8255] | 66 |  | 
|---|
| [8495] | 67 |         private: | 
|---|
 | 68 |                 Billboard* billboard[4]; | 
|---|
 | 69 |                 bool lighteningActivate; | 
|---|
 | 70 |                 bool lighteningMove; | 
|---|
 | 71 |                  | 
|---|
 | 72 |                 float flashFrequency; | 
|---|
 | 73 |                 float mainFrequency; | 
|---|
 | 74 |                 float flashConstTime; | 
|---|
 | 75 |                 float flashRisingTime; | 
|---|
 | 76 |                  | 
|---|
 | 77 |                 float time; | 
|---|
 | 78 |                  | 
|---|
 | 79 |                 bool  bNewCoordinate; | 
|---|
 | 80 |                 float width; | 
|---|
 | 81 |                 float height; | 
|---|
 | 82 |                 float seedWidth; | 
|---|
 | 83 |                 float seedHeight; | 
|---|
 | 84 |                  | 
|---|
 | 85 |                 float seedX; | 
|---|
 | 86 |                 float seedZ; | 
|---|
 | 87 |                 float seedTime; | 
|---|
 | 88 |                  | 
|---|
 | 89 |                 float mainPosX; | 
|---|
 | 90 |                 float mainPosY; | 
|---|
 | 91 |                 float mainPosZ; | 
|---|
 | 92 |                  | 
|---|
 | 93 |                 Vector cameraCoor; | 
|---|
 | 94 |                  | 
|---|
 | 95 |                 Light* flashLight; | 
|---|
 | 96 |                  | 
|---|
 | 97 |                 //OrxSound::SoundSource    soundSource; | 
|---|
 | 98 |                 //OrxSound::SoundBuffer*   thunderBuffer; | 
|---|
| [8255] | 99 |  | 
|---|
| [7679] | 100 | }; | 
|---|
 | 101 |  | 
|---|
 | 102 | #endif  /* _LIGHTENING_EFFECT */ | 
|---|