15 #include "ringEmitter.h"
24 _radius(1.0f), _radius_spread(0.0f), _aoe(0.0f), _uniform_emission(0), _theta(0.0f)
36 _radius = copy._radius;
38 _radius_spread = copy._radius_spread;
39 _uniform_emission = copy._uniform_emission;
42 _sin_theta = copy._sin_theta;
43 _cos_theta = copy._cos_theta;
71 assign_initial_position(
LPoint3& pos) {
72 if (_uniform_emission > 0)
74 _theta = _theta + 1.0/_uniform_emission;
76 _theta = _theta - 1.0;
80 _theta = NORMALIZED_RAND();
83 _cos_theta = cosf(_theta * 2.0f * MathNumbers::pi_f);
84 _sin_theta = sinf(_theta * 2.0f * MathNumbers::pi_f);
86 PN_stdfloat new_radius_spread = SPREAD(_radius_spread);
87 PN_stdfloat new_x = _cos_theta * (_radius + new_radius_spread);
88 PN_stdfloat new_y = _sin_theta * (_radius + new_radius_spread);
90 pos.set(new_x, new_y, 0.0f);
99 assign_initial_velocity(
LVector3& vel) {
100 PN_stdfloat vel_z = sinf(deg_2_rad(_aoe));
101 PN_stdfloat abs_diff = fabs(1.0f - (vel_z * vel_z));
102 PN_stdfloat root_mag_minus_z_squared = sqrtf(abs_diff);
104 PN_stdfloat vel_x = _cos_theta * root_mag_minus_z_squared;
105 PN_stdfloat vel_y = _sin_theta * root_mag_minus_z_squared;
108 if((_aoe > 90.0f) && (_aoe < 270.0f))
114 vel.set(vel_x, vel_y, vel_z);
137 write(ostream &out,
int indent)
const {
139 out.width(indent); out<<
""; out<<
"RingEmitter:\n";
140 out.width(indent+2); out<<
""; out<<
"_radius "<<_radius<<
"\n";
141 out.width(indent+2); out<<
""; out<<
"_radius_spread "<<_radius_spread<<
"\n";
142 out.width(indent+2); out<<
""; out<<
"_aoe "<<_aoe<<
"\n";
143 out.width(indent+2); out<<
""; out<<
"_sin_theta "<<_sin_theta<<
"\n";
144 out.width(indent+2); out<<
""; out<<
"_cos_theta "<<_cos_theta<<
"\n";
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Describes a planar ring region in which particles are generated.
virtual ~RingEmitter()
destructor
virtual void write(ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
virtual void write(ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Describes a physical region in space in which particles are randomly generated.
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
virtual BaseParticleEmitter * make_copy()
copier