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 | class Billboard; |
---|
17 | class Light; |
---|
18 | |
---|
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 | |
---|
27 | virtual void init(); |
---|
28 | |
---|
29 | virtual void activate(); |
---|
30 | virtual void deactivate(); |
---|
31 | |
---|
32 | inline void activateLightening() { this->activate(); } |
---|
33 | inline void deactivateLightening() { this->deactivate(); } |
---|
34 | |
---|
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 | } |
---|
45 | |
---|
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; } |
---|
53 | |
---|
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 | |
---|
66 | |
---|
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; |
---|
99 | |
---|
100 | }; |
---|
101 | |
---|
102 | #endif /* _LIGHTENING_EFFECT */ |
---|