00001 // Filename: pointEmitter.cxx 00002 // Created by: charles (22Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "pointEmitter.h" 00016 00017 //////////////////////////////////////////////////////////////////// 00018 // Function : PointEmitter 00019 // Access : Public 00020 // Description : constructor 00021 //////////////////////////////////////////////////////////////////// 00022 PointEmitter:: 00023 PointEmitter() : 00024 BaseParticleEmitter() { 00025 _location.set(0.0f, 0.0f, 0.0f); 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function : PointEmitter 00030 // Access : Public 00031 // Description : copy constructor 00032 //////////////////////////////////////////////////////////////////// 00033 PointEmitter:: 00034 PointEmitter(const PointEmitter ©) : 00035 BaseParticleEmitter(copy) { 00036 _location = copy._location; 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function : ~PointEmitter 00041 // Access : Public 00042 // Description : destructor 00043 //////////////////////////////////////////////////////////////////// 00044 PointEmitter:: 00045 ~PointEmitter() { 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function : make_copy 00050 // Access : Public 00051 // Description : copier 00052 //////////////////////////////////////////////////////////////////// 00053 BaseParticleEmitter *PointEmitter:: 00054 make_copy() { 00055 return new PointEmitter(*this); 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function : PointEmitter::assign_initial_position 00060 // Access : Public 00061 // Description : Generates a location for a new particle 00062 //////////////////////////////////////////////////////////////////// 00063 void PointEmitter:: 00064 assign_initial_position(LPoint3& pos) { 00065 pos = _location; 00066 } 00067 00068 //////////////////////////////////////////////////////////////////// 00069 // Function : PointEmitter::assign_initial_velocity 00070 // Access : Public 00071 // Description : Generates a velocity for a new particle 00072 //////////////////////////////////////////////////////////////////// 00073 void PointEmitter:: 00074 assign_initial_velocity(LVector3& vel) { 00075 vel.set(0,0,0); 00076 } 00077 00078 //////////////////////////////////////////////////////////////////// 00079 // Function : output 00080 // Access : Public 00081 // Description : Write a string representation of this instance to 00082 // <out>. 00083 //////////////////////////////////////////////////////////////////// 00084 void PointEmitter:: 00085 output(ostream &out) const { 00086 #ifndef NDEBUG //[ 00087 out<<"PointEmitter"; 00088 #endif //] NDEBUG 00089 } 00090 00091 //////////////////////////////////////////////////////////////////// 00092 // Function : write 00093 // Access : Public 00094 // Description : Write a string representation of this instance to 00095 // <out>. 00096 //////////////////////////////////////////////////////////////////// 00097 void PointEmitter:: 00098 write(ostream &out, int indent) const { 00099 #ifndef NDEBUG //[ 00100 out.width(indent); out<<""; out<<"PointEmitter:\n"; 00101 out.width(indent+2); out<<""; out<<"_location "<<_location<<"\n"; 00102 BaseParticleEmitter::write(out, indent+2); 00103 #endif //] NDEBUG 00104 }