22 _inner_aoe = _outer_aoe = 0.0f;
23 _inner_magnitude = _outer_magnitude = 1.0f;
24 _cubic_lerping =
false;
33 _radius = copy._radius;
34 _inner_aoe = copy._inner_aoe;
35 _outer_aoe = copy._outer_aoe;
36 _inner_magnitude = copy._inner_magnitude;
37 _outer_magnitude = copy._outer_magnitude;
38 _cubic_lerping = copy._cubic_lerping;
40 _distance_from_center = copy._distance_from_center;
41 _sinf_theta = copy._sinf_theta;
42 _cosf_theta = copy._cosf_theta;
64 assign_initial_position(LPoint3& pos) {
66 PN_stdfloat theta = NORMALIZED_RAND() * 2.0f * MathNumbers::pi_f;
68 _distance_from_center = NORMALIZED_RAND();
69 PN_stdfloat r_scalar = _distance_from_center * _radius;
71 _sinf_theta = sinf(theta);
72 _cosf_theta = cosf(theta);
74 PN_stdfloat new_x = _cosf_theta * r_scalar;
75 PN_stdfloat new_y = _sinf_theta * r_scalar;
77 pos.set(new_x, new_y, 0.0f);
84 assign_initial_velocity(LVector3& vel) {
88 if (_cubic_lerping ==
true) {
89 aoe = CLERP(_distance_from_center, _inner_aoe, _outer_aoe);
90 mag = CLERP(_distance_from_center, _inner_magnitude, _outer_magnitude);
93 aoe = LERP(_distance_from_center, _inner_aoe, _outer_aoe);
94 mag = LERP(_distance_from_center, _inner_magnitude, _outer_magnitude);
98 PN_stdfloat vel_z = mag * sinf(deg_2_rad(aoe));
99 PN_stdfloat abs_diff = fabs((mag * mag) - (vel_z * vel_z));
100 PN_stdfloat root_mag_minus_z_squared = sqrtf(abs_diff);
101 PN_stdfloat vel_x = _cosf_theta * root_mag_minus_z_squared;
102 PN_stdfloat vel_y = _sinf_theta * root_mag_minus_z_squared;
105 if((aoe > 90.0f) && (aoe < 270.0f))
111 vel.set(vel_x, vel_y, vel_z);
130 out.width(
indent); out<<
""; out<<
"DiscEmitter:\n";
131 out.width(
indent+2); out<<
""; out<<
"_radius "<<_radius<<
"\n";
132 out.width(
indent+2); out<<
""; out<<
"_outer_aoe "<<_outer_aoe<<
"\n";
133 out.width(
indent+2); out<<
""; out<<
"_inner_aoe "<<_inner_aoe<<
"\n";
134 out.width(
indent+2); out<<
""; out<<
"_outer_magnitude "<<_outer_magnitude<<
"\n";
135 out.width(
indent+2); out<<
""; out<<
"_inner_magnitude "<<_inner_magnitude<<
"\n";
136 out.width(
indent+2); out<<
""; out<<
"_cubic_lerping "<<_cubic_lerping<<
"\n";
137 out.width(
indent+2); out<<
""; out<<
"_distance_from_center "<<_distance_from_center<<
"\n";
138 out.width(
indent+2); out<<
""; out<<
"_sinf_theta "<<_sinf_theta<<
"\n";
139 out.width(
indent+2); out<<
""; out<<
"_cosf_theta "<<_cosf_theta<<
"\n";
virtual ~DiscEmitter()
destructor
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
virtual BaseParticleEmitter * make_copy()
copier
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Describes a planar disc region from which particles are generated.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.