Panda3D
panda
src
particlesystem
tangentRingEmitter.cxx
Go to the documentation of this file.
1
/**
2
* PANDA 3D SOFTWARE
3
* Copyright (c) Carnegie Mellon University. All rights reserved.
4
*
5
* All use of this software is subject to the terms of the revised BSD
6
* license. You should have received a copy of this license along
7
* with this source code in a file named "LICENSE."
8
*
9
* @file tangentRingEmitter.cxx
10
* @author charles
11
* @date 2000-07-25
12
*/
13
14
#include "
tangentRingEmitter.h
"
15
16
/**
17
* constructor
18
*/
19
TangentRingEmitter::
20
TangentRingEmitter
() {
21
_radius = 1.0f;
22
_radius_spread = 0.0f;
23
}
24
25
/**
26
* copy constructor
27
*/
28
TangentRingEmitter::
29
TangentRingEmitter
(
const
TangentRingEmitter
©) :
30
BaseParticleEmitter
(copy) {
31
_radius = copy._radius;
32
_radius_spread = copy._radius_spread;
33
}
34
35
/**
36
* destructor
37
*/
38
TangentRingEmitter::
39
~TangentRingEmitter
() {
40
}
41
42
/**
43
* child copier
44
*/
45
BaseParticleEmitter
*
TangentRingEmitter::
46
make_copy
() {
47
return
new
TangentRingEmitter
(*
this
);
48
}
49
50
/**
51
* Generates a location for a new particle
52
*/
53
void
TangentRingEmitter::
54
assign_initial_position(LPoint3& pos) {
55
PN_stdfloat theta = NORMALIZED_RAND() * 2.0f * MathNumbers::pi_f;
56
57
_x = cosf(theta);
58
_y = sinf(theta);
59
60
PN_stdfloat new_radius = _radius + SPREAD(_radius_spread);
61
pos.set(new_radius * _x, new_radius * _y, 0.0f);
62
}
63
64
/**
65
* Generates a velocity for a new particle
66
*/
67
void
TangentRingEmitter::
68
assign_initial_velocity(LVector3& vel) {
69
vel.set(-_y, _x, 0.0f);
70
}
71
72
/**
73
* Write a string representation of this instance to <out>.
74
*/
75
void
TangentRingEmitter::
76
output
(std::ostream &out)
const
{
77
#ifndef NDEBUG //[
78
out<<
"TangentRingEmitter"
;
79
#endif //] NDEBUG
80
}
81
82
/**
83
* Write a string representation of this instance to <out>.
84
*/
85
void
TangentRingEmitter::
86
write
(std::ostream &out,
int
indent
)
const
{
87
#ifndef NDEBUG //[
88
out.width(
indent
); out<<
""
; out<<
"TangentRingEmitter:\n"
;
89
out.width(
indent
+2); out<<
""
; out<<
"_radius "
<<_radius<<
"\n"
;
90
out.width(
indent
+2); out<<
""
; out<<
"_radius_spread "
<<_radius_spread<<
"\n"
;
91
out.width(
indent
+2); out<<
""
; out<<
"_x "
<<_x<<
"\n"
;
92
out.width(
indent
+2); out<<
""
; out<<
"_y "
<<_y<<
"\n"
;
93
BaseParticleEmitter::write
(out,
indent
+2);
94
#endif //] NDEBUG
95
}
TangentRingEmitter::output
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
Definition:
tangentRingEmitter.cxx:76
TangentRingEmitter::make_copy
virtual BaseParticleEmitter * make_copy()
child copier
Definition:
tangentRingEmitter.cxx:46
BaseParticleEmitter::write
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Definition:
baseParticleEmitter.cxx:92
tangentRingEmitter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TangentRingEmitter::write
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Definition:
tangentRingEmitter.cxx:86
indent
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition:
indent.cxx:20
TangentRingEmitter::TangentRingEmitter
TangentRingEmitter()
constructor
Definition:
tangentRingEmitter.cxx:20
TangentRingEmitter
Describes a planar ring region in which tangent particles are generated, and particles fly off tangen...
Definition:
tangentRingEmitter.h:23
BaseParticleEmitter
Definition:
baseParticleEmitter.h:25
TangentRingEmitter::~TangentRingEmitter
virtual ~TangentRingEmitter()
destructor
Definition:
tangentRingEmitter.cxx:39
Generated on Wed Jan 23 2019 21:40:08 for Panda3D by
1.8.15