Panda3D
Loading...
Searching...
No Matches
baseParticleFactory.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 baseParticleFactory.cxx
10 * @author charles
11 * @date 2000-07-05
12 */
13
14#include "baseParticleFactory.h"
15
16/**
17 * constructor
18 */
19BaseParticleFactory::
20BaseParticleFactory() :
21 _lifespan_base(1.0),
22 _lifespan_spread(0.0),
23 _mass_base(1.0f),
24 _mass_spread(0.0f),
25 _terminal_velocity_base(PhysicsObject::_default_terminal_velocity),
26 _terminal_velocity_spread(0.0f)
27{
28}
29
30/**
31 * copy constructor
32 */
33BaseParticleFactory::
34BaseParticleFactory(const BaseParticleFactory &copy) :
35 _lifespan_base(copy._lifespan_base),
36 _lifespan_spread(copy._lifespan_spread),
37 _mass_base(copy._mass_base),
38 _mass_spread(copy._mass_spread),
39 _terminal_velocity_base(copy._terminal_velocity_base),
40 _terminal_velocity_spread(copy._terminal_velocity_spread)
41{
42}
43
44/**
45 * destructor
46 */
50
51/**
52 * public
53 */
56 bp->set_lifespan(_lifespan_base + SPREAD(_lifespan_spread));
57 bp->set_mass(_mass_base + SPREAD(_mass_spread));
58 bp->set_terminal_velocity(_terminal_velocity_base + SPREAD(_terminal_velocity_spread));
59
60 bp->set_active(false);
61 bp->set_alive(false);
62 bp->set_age(0.0f);
63 bp->set_index(0);
64
65 populate_child_particle(bp);
66}
67
68/**
69 * Write a string representation of this instance to <out>.
70 */
72output(std::ostream &out) const {
73 #ifndef NDEBUG //[
74 out<<"BaseParticleFactory";
75 #endif //] NDEBUG
76}
77
78/**
79 * Write a string representation of this instance to <out>.
80 */
82write(std::ostream &out, int indent) const {
83 #ifndef NDEBUG //[
84 out.width(indent); out<<""; out<<"BaseParticleFactory:\n";
85 out.width(indent+2); out<<""; out<<"_lifespan_base "<<_lifespan_base<<"\n";
86 out.width(indent+2); out<<""; out<<"_lifespan_spread "<<_lifespan_spread<<"\n";
87 out.width(indent+2); out<<""; out<<"_mass_base "<<_mass_base<<"\n";
88 out.width(indent+2); out<<""; out<<"_mass_spread "<<_mass_spread<<"\n";
89 out.width(indent+2); out<<""; out<<"_terminal_velocity_base "<<_terminal_velocity_base<<"\n";
90 out.width(indent+2); out<<""; out<<"_terminal_velocity_spread "<<_terminal_velocity_spread<<"\n";
91 // ReferenceCount::write(out, indent+2);
92 #endif //] NDEBUG
93}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Pure Virtual base class for creating particles.
virtual ~BaseParticleFactory()
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>.
void populate_particle(BaseParticle *bp)
public
An individual, physically-modelable particle abstract base class.
A body on which physics will be applied.
set_active
Process Flag assignment.
set_mass
Set the mass in slugs (or kilograms).
set_terminal_velocity
tv assignment
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition indent.cxx:20