1 /*! 2 \brief Special effects that have objects blow around under the wind. 3 */ 4 5 #ifndef EFFECT_WIND_H 6 #define EFFECT_WIND_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 18 class WindEffect : public Effect 19 { 20 public: 21 enum WindType 22 { 23 LEAVES, 24 FLOWER_PETALS, 25 SNOW 26 }; 27 28 struct WindNeighbor 29 { 30 WindEffect* neighbor; 31 angle_t start_angle; 32 angle_t end_angle; 33 }; 34 35 WindEffect(EyeCandy* _base, bool* _dead, Vec3* _pos, 36 std::vector<ec::Obstruction*>* _obstructions, 37 const color_t _hue_adjust, const color_t _saturation_adjust, 38 const coord_t _scalar, const float _density, 39 BoundingRange* _bounding_range, const WindType _type, 40 const Vec3 _prevailing_wind); 41 ~WindEffect(); 42 43 void set_pass_off(std::vector<WindEffect*> pass_off_to); // Required! 44 void set_pass_off(std::vector<Effect*> pass_off_to); // Required! 45 get_type()46 EffectEnum get_type() 47 { 48 return EC_WIND; 49 } 50 ; 51 bool idle(const Uint64 usec); request_LOD(const float _LOD)52 virtual void request_LOD(const float _LOD) 53 { 54 if (fabs(_LOD - (float)LOD) < 1.0) 55 return; 56 const Uint16 rounded_LOD = (Uint16)round(_LOD); 57 if (rounded_LOD <= desired_LOD) 58 LOD = rounded_LOD; 59 else 60 LOD = desired_LOD; 61 count = LOD * max_LOD1_count; 62 } 63 ; 64 65 ParticleMover* mover; 66 FilledBoundingSpawner* spawner; 67 WindType type; 68 Vec3 center; 69 color_t hue_adjust; 70 color_t saturation_adjust; 71 float scalar; 72 Vec3 prevailing_wind; 73 coord_t max_adjust; 74 Vec3 overall_wind_adjust; 75 Vec3 overall_wind; 76 int max_LOD1_count; 77 int count; 78 std::vector<WindNeighbor> neighbors; // Where to pass particles off to. 79 BoundingRange* bounding_range; 80 }; 81 82 class WindParticle : public Particle 83 { 84 public: 85 WindParticle(Effect* _effect, ParticleMover* _mover, 86 const Vec3 _pos, const Vec3 _velocity, 87 const color_t hue_adjust, const color_t saturation_adjust, 88 const coord_t scalar, const coord_t _min_height, 89 const coord_t _max_height, const WindEffect::WindType _type); ~WindParticle()90 ~WindParticle() 91 { 92 } 93 94 virtual bool idle(const Uint64 delta_t); 95 virtual Uint32 get_texture(); 96 virtual float get_burn() const; estimate_light_level()97 virtual light_t estimate_light_level() const 98 { 99 return 0.0; 100 } 101 ; // We don't want the particle system lights to be used on the pos, since it will assumedly already have one. get_light_level()102 virtual light_t get_light_level() 103 { 104 return 0.0; 105 } 106 ; 107 Vec3 get_wind_vec() const; 108 109 coord_t min_height; 110 coord_t max_height; 111 WindEffect::WindType type; 112 Uint8 subtype; 113 Vec3 rotation_axes[3]; 114 percent_t axis_weights[3]; 115 Quaternion quaternion; 116 }; 117 118 /////////////////////////////////////////////////////////////////////////////// 119 120 } // End namespace ec 121 122 #endif // defined EFFECT_WIND_H 123