1 /*!
2  \brief A special effect that creates a column of black smoke in the air.
3  */
4 
5 #ifndef EFFECT_SMOKE_H
6 #define EFFECT_SMOKE_H
7 
8 // I N C L U D E S ////////////////////////////////////////////////////////////
9 
10 #include "eye_candy.h"
11 
12 namespace ec
13 {
14 
15 	// C L A S S E S //////////////////////////////////////////////////////////////
16 
17 	class SmokeParticle : public Particle
18 	{
19 		public:
20 			SmokeParticle(Effect* _effect, ParticleMover* _mover,
21 				const Vec3 _pos, const Vec3 _velocity,
22 				const color_t hue_adjust, const color_t saturation_adjust,
23 				const coord_t _sqrt_scale, const coord_t _max_size,
24 				const coord_t size_scalar, const alpha_t alpha_scale);
~SmokeParticle()25 			~SmokeParticle()
26 			{
27 			}
28 
29 			virtual bool idle(const Uint64 delta_t);
30 			virtual Uint32 get_texture();
31 			virtual float get_burn() const;
estimate_light_level()32 			virtual light_t estimate_light_level() const
33 			{
34 				return 0.0;
35 			}
36 			; // No glow.
get_light_level()37 			virtual light_t get_light_level()
38 			{
39 				return 0.0;
40 			}
41 			; // Same.
42 
43 			coord_t sqrt_scale;
44 			coord_t max_size;
45 	};
46 
47 	class SmokeEffect : public Effect
48 	{
49 		public:
50 			SmokeEffect(EyeCandy* _base, bool* _dead, Vec3* _pos,
51 				const color_t _hue_adjust, const color_t _saturation_adjust,
52 				const float _scale, const Uint16 _LOD);
53 			~SmokeEffect();
54 
get_type()55 			virtual EffectEnum get_type()
56 			{
57 				return EC_SMOKE;
58 			}
59 			;
60 			bool idle(const Uint64 usec);
request_LOD(const float _LOD)61 			virtual void request_LOD(const float _LOD)
62 			{
63 				if (fabs(_LOD - (float)LOD) < 1.0)
64 					return;
65 				const Uint16 rounded_LOD = (Uint16)round(_LOD);
66 				if (rounded_LOD <= desired_LOD)
67 					LOD = rounded_LOD;
68 				else
69 					LOD = desired_LOD;
70 				max_size = scale * 270 / (_LOD + 10);
71 				size_scalar = sqrt_scale * 75 / (_LOD + 5);
72 				alpha_scalar = 6.5 / (std::sqrt(_LOD) + 1.0);
73 				count_scalar = 500000 / LOD;
74 			}
75 			;
76 
77 			ParticleMover* mover;
78 			ParticleSpawner* spawner;
79 			color_t hue_adjust;
80 			color_t saturation_adjust;
81 			interval_t count;
82 			float scale;
83 			coord_t sqrt_scale;
84 			coord_t max_size;
85 			coord_t size_scalar;
86 			alpha_t alpha_scalar;
87 			Uint32 count_scalar;
88 	};
89 
90 ///////////////////////////////////////////////////////////////////////////////
91 
92 } // End namespace ec
93 
94 #endif	// defined EFFECT_SMOKE_H
95