Panda3D
orientedParticleFactory.cxx
1 // Filename: orientedParticleFactory.cxx
2 // Created by: charles (05Jul00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "orientedParticleFactory.h"
16 #include "orientedParticle.h"
17 
18 ////////////////////////////////////////////////////////////////////
19 // Function : OrientedParticleFactory
20 // Access : Public
21 // Description : Constructor
22 ////////////////////////////////////////////////////////////////////
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function : OrientedParticleFactory
30 // Access : Public
31 // Description : copy Constructor
32 ////////////////////////////////////////////////////////////////////
35  BaseParticleFactory(copy) {
36  _initial_orientation = copy._initial_orientation;
37  _final_orientation = copy._final_orientation;
38 }
39 
40 ////////////////////////////////////////////////////////////////////
41 // Function : ~OrientedParticleFactory
42 // Access : public
43 // Description : destructor
44 ////////////////////////////////////////////////////////////////////
47 }
48 
49 ////////////////////////////////////////////////////////////////////
50 // Function : populate_child_particle
51 // Access : private
52 // Description : child spawn
53 ////////////////////////////////////////////////////////////////////
54 void OrientedParticleFactory::
55 populate_child_particle(BaseParticle *bp) const {
56  bp->set_orientation(_initial_orientation);
57 }
58 
59 ////////////////////////////////////////////////////////////////////
60 // Function : alloc_particle
61 // Access : public
62 // Description : child particle generation function
63 ////////////////////////////////////////////////////////////////////
64 BaseParticle *OrientedParticleFactory::
65 alloc_particle() const {
66  return new OrientedParticle;
67 }
68 
69 ////////////////////////////////////////////////////////////////////
70 // Function : output
71 // Access : Public
72 // Description : Write a string representation of this instance to
73 // <out>.
74 ////////////////////////////////////////////////////////////////////
76 output(ostream &out) const {
77  #ifndef NDEBUG //[
78  out<<"OrientedParticleFactory";
79  #endif //] NDEBUG
80 }
81 
82 ////////////////////////////////////////////////////////////////////
83 // Function : write
84 // Access : Public
85 // Description : Write a string representation of this instance to
86 // <out>.
87 ////////////////////////////////////////////////////////////////////
89 write(ostream &out, int indent) const {
90  #ifndef NDEBUG //[
91  out.width(indent); out<<""; out<<"OrientedParticleFactory:\n";
92  BaseParticleFactory::write(out, indent+2);
93  #endif //] NDEBUG
94 }
virtual void write(ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
virtual ~OrientedParticleFactory()
destructor
Pure Virtual base class for creating particles.
Describes a particle that has angular characteristics (velocity, orientation).
Creates particles that are affected by angular forces.
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
virtual void write(ostream &out, unsigned int indent=0) const
Write a string representation of this instance to <out>.
An individual, physically-modelable particle abstract base class.
Definition: baseParticle.h:26