Panda3D
orientedParticle.cxx
1 // Filename: orientedParticle.cxx
2 // Created by: charles (19Jun00)
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 "orientedParticle.h"
16 
17 ////////////////////////////////////////////////////////////////////
18 // Function : OrientedParticle
19 // Access : public
20 // Description : simple constructor
21 ////////////////////////////////////////////////////////////////////
23 OrientedParticle(int lifespan, bool alive) :
24  BaseParticle(lifespan, alive) {
25  set_oriented(true);
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function : OrientedParticle
30 // Access : public
31 // Description : copy constructor
32 ////////////////////////////////////////////////////////////////////
35  BaseParticle(copy) {
36 }
37 
38 ////////////////////////////////////////////////////////////////////
39 // Function : ~OrientedParticle
40 // Access : public
41 // Description : simple destructor
42 ////////////////////////////////////////////////////////////////////
45 }
46 
47 ////////////////////////////////////////////////////////////////////
48 // Function : make_copy
49 // Access : public, virtual
50 // Description : simple destructor
51 ////////////////////////////////////////////////////////////////////
53 make_copy() const {
54  return new OrientedParticle(*this);
55 }
56 
57 ////////////////////////////////////////////////////////////////////
58 // Function : init
59 // Access : Public
60 // Description : particle init routine
61 ////////////////////////////////////////////////////////////////////
63 init() {
64 }
65 
66 ////////////////////////////////////////////////////////////////////
67 // Function : die
68 // Access : public
69 // Description : particle death routine
70 ////////////////////////////////////////////////////////////////////
72 die() {
73 }
74 
75 ////////////////////////////////////////////////////////////////////
76 // Function : update
77 // Access : public
78 // Description : particle update routine.
79 // This NEEDS to be filled in with quaternion slerp
80 // stuff, or oriented particles will not rotate.
81 ////////////////////////////////////////////////////////////////////
83 update() {
84 }
85 
86 ////////////////////////////////////////////////////////////////////
87 // Function : output
88 // Access : Public
89 // Description : Write a string representation of this instance to
90 // <out>.
91 ////////////////////////////////////////////////////////////////////
93 output(ostream &out) const {
94  #ifndef NDEBUG //[
95  out<<"OrientedParticle";
96  #endif //] NDEBUG
97 }
98 
99 ////////////////////////////////////////////////////////////////////
100 // Function : write
101 // Access : Public
102 // Description : Write a string representation of this instance to
103 // <out>.
104 ////////////////////////////////////////////////////////////////////
106 write(ostream &out, int indent) const {
107  #ifndef NDEBUG //[
108  out.width(indent); out<<""; out<<"OrientedParticle:\n";
109  BaseParticle::write(out, indent+2);
110  #endif //] NDEBUG
111 }
A body on which physics will be applied.
Definition: physicsObject.h:29
virtual void init()
particle init routine
virtual PhysicsObject * make_copy() const
simple destructor
Describes a particle that has angular characteristics (velocity, orientation).
virtual ~OrientedParticle()
simple destructor
virtual void write(ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
virtual void update()
particle update routine.
OrientedParticle(int lifespan=0, bool alive=false)
simple constructor
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
virtual void die()
particle death routine
An individual, physically-modelable particle abstract base class.
Definition: baseParticle.h:26
virtual void write(ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
void set_oriented(bool flag)
Set flag to determine whether this object should do any rotation or orientation calculations.