1 #ifndef CONE_GENERATOR_EFFECT_H 2 #define CONE_GENERATOR_EFFECT_H 3 #pragma once 4 5 #include "globalincs/pstypes.h" 6 7 #include "particle/ParticleEffect.h" 8 #include "particle/ParticleManager.h" 9 #include "utils/RandomRange.h" 10 11 namespace particle { 12 namespace effects { 13 14 /** 15 * @ingroup particleEffects 16 */ 17 class ConeShape { 18 ::util::NormalFloatRange m_normalDeviation; 19 public: ConeShape()20 ConeShape() {} 21 getDisplacementMatrix()22 matrix getDisplacementMatrix() { 23 angles angs; 24 25 angs.b = 0.0f; 26 27 angs.h = m_normalDeviation.next(); 28 angs.p = m_normalDeviation.next(); 29 30 matrix m; 31 32 vm_angles_2_matrix(&m, &angs); 33 34 return m; 35 } 36 parse(bool nocreate)37 void parse(bool nocreate) { 38 if (internal::required_string_if_new("+Deviation:", nocreate)) { 39 float deviation; 40 stuff_float(&deviation); 41 42 if (deviation < 0.001f) { 43 error_display(0, "A standard deviation of %f is not valid. Must be greater than 0. Defaulting to 1.", 44 deviation); 45 deviation = 1.0f; 46 } 47 48 m_normalDeviation = ::util::NormalFloatRange(0.0, fl_radians(deviation)); 49 } 50 } 51 getType()52 EffectType getType() const { return EffectType::Cone; } 53 54 /** 55 * @brief Specifies if the velocities of the particles should be scaled with the deviation from the direction 56 * @return @c true 57 */ scale_velocity_deviation()58 static constexpr bool scale_velocity_deviation() { 59 return true; 60 } 61 }; 62 63 } 64 } 65 66 #endif // CONE_GENERATOR_EFFECT_H 67