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