Panda3D
panda
src
particlesystem
sphereSurfaceEmitter.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 sphereSurfaceEmitter.cxx
10
* @author charles
11
* @date 2000-06-22
12
*/
13
14
#include "
sphereSurfaceEmitter.h
"
15
16
/**
17
* constructor
18
*/
19
SphereSurfaceEmitter::
20
SphereSurfaceEmitter
() {
21
_radius = 1.0f;
22
}
23
24
/**
25
* copy constructor
26
*/
27
SphereSurfaceEmitter::
28
SphereSurfaceEmitter
(
const
SphereSurfaceEmitter
©) :
29
BaseParticleEmitter
(copy) {
30
_radius = copy._radius;
31
}
32
33
/**
34
* destructor
35
*/
36
SphereSurfaceEmitter::
37
~SphereSurfaceEmitter
() {
38
}
39
40
/**
41
* copier
42
*/
43
BaseParticleEmitter
*
SphereSurfaceEmitter::
44
make_copy
() {
45
return
new
SphereSurfaceEmitter
(*
this
);
46
}
47
48
/**
49
* Generates a location for a new particle
50
*/
51
void
SphereSurfaceEmitter::
52
assign_initial_position(LPoint3& pos) {
53
PN_stdfloat z, theta, r;
54
55
z = SPREAD(_radius);
56
r = sqrtf((_radius * _radius) - (z * z));
57
theta = NORMALIZED_RAND() * 2.0f * MathNumbers::pi_f;
58
59
pos.set(r * cosf(theta), r * sinf(theta), z);
60
}
61
62
/**
63
* Generates a velocity for a new particle
64
*/
65
void
SphereSurfaceEmitter::
66
assign_initial_velocity(LVector3& vel) {
67
vel.set(0,0,0);
68
}
69
70
/**
71
* Write a string representation of this instance to <out>.
72
*/
73
void
SphereSurfaceEmitter::
74
output
(std::ostream &out)
const
{
75
#ifndef NDEBUG //[
76
out<<
"SphereSurfaceEmitter"
;
77
#endif //] NDEBUG
78
}
79
80
/**
81
* Write a string representation of this instance to <out>.
82
*/
83
void
SphereSurfaceEmitter::
84
write
(std::ostream &out,
int
indent
)
const
{
85
#ifndef NDEBUG //[
86
out.width(
indent
); out<<
""
; out<<
"SphereSurfaceEmitter:\n"
;
87
out.width(
indent
+2); out<<
""
; out<<
"_radius "
<<_radius<<
"\n"
;
88
BaseParticleEmitter::write
(out,
indent
+2);
89
#endif //] NDEBUG
90
}
SphereSurfaceEmitter::output
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
Definition:
sphereSurfaceEmitter.cxx:74
SphereSurfaceEmitter::write
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Definition:
sphereSurfaceEmitter.cxx:84
SphereSurfaceEmitter::make_copy
virtual BaseParticleEmitter * make_copy()
copier
Definition:
sphereSurfaceEmitter.cxx:44
SphereSurfaceEmitter
Describes a curved space in which particles are generated.
Definition:
sphereSurfaceEmitter.h:22
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
SphereSurfaceEmitter::SphereSurfaceEmitter
SphereSurfaceEmitter()
constructor
Definition:
sphereSurfaceEmitter.cxx:20
indent
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition:
indent.cxx:20
SphereSurfaceEmitter::~SphereSurfaceEmitter
virtual ~SphereSurfaceEmitter()
destructor
Definition:
sphereSurfaceEmitter.cxx:37
BaseParticleEmitter
Definition:
baseParticleEmitter.h:25
sphereSurfaceEmitter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Generated on Wed Jan 23 2019 21:40:08 for Panda3D by
1.8.15