00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "baseParticleFactory.h"
00016
00017
00018
00019
00020
00021
00022 BaseParticleFactory::
00023 BaseParticleFactory() :
00024 _lifespan_base(1.0),
00025 _lifespan_spread(0.0),
00026 _mass_base(1.0f),
00027 _mass_spread(0.0f),
00028 _terminal_velocity_base(PhysicsObject::_default_terminal_velocity),
00029 _terminal_velocity_spread(0.0f)
00030 {
00031 }
00032
00033
00034
00035
00036
00037
00038 BaseParticleFactory::
00039 BaseParticleFactory(const BaseParticleFactory ©) :
00040 _lifespan_base(copy._lifespan_base),
00041 _lifespan_spread(copy._lifespan_spread),
00042 _mass_base(copy._mass_base),
00043 _mass_spread(copy._mass_spread),
00044 _terminal_velocity_base(copy._terminal_velocity_base),
00045 _terminal_velocity_spread(copy._terminal_velocity_spread)
00046 {
00047 }
00048
00049
00050
00051
00052
00053
00054 BaseParticleFactory::
00055 ~BaseParticleFactory() {
00056 }
00057
00058
00059
00060
00061
00062 void BaseParticleFactory::
00063 populate_particle(BaseParticle *bp) {
00064 bp->set_lifespan(_lifespan_base + SPREAD(_lifespan_spread));
00065 bp->set_mass(_mass_base + SPREAD(_mass_spread));
00066 bp->set_terminal_velocity(_terminal_velocity_base + SPREAD(_terminal_velocity_spread));
00067
00068 bp->set_active(false);
00069 bp->set_alive(false);
00070 bp->set_age(0.0f);
00071 bp->set_index(0);
00072
00073 populate_child_particle(bp);
00074 }
00075
00076
00077
00078
00079
00080
00081
00082 void BaseParticleFactory::
00083 output(ostream &out) const {
00084 #ifndef NDEBUG //[
00085 out<<"BaseParticleFactory";
00086 #endif //] NDEBUG
00087 }
00088
00089
00090
00091
00092
00093
00094
00095 void BaseParticleFactory::
00096 write(ostream &out, int indent) const {
00097 #ifndef NDEBUG //[
00098 out.width(indent); out<<""; out<<"BaseParticleFactory:\n";
00099 out.width(indent+2); out<<""; out<<"_lifespan_base "<<_lifespan_base<<"\n";
00100 out.width(indent+2); out<<""; out<<"_lifespan_spread "<<_lifespan_spread<<"\n";
00101 out.width(indent+2); out<<""; out<<"_mass_base "<<_mass_base<<"\n";
00102 out.width(indent+2); out<<""; out<<"_mass_spread "<<_mass_spread<<"\n";
00103 out.width(indent+2); out<<""; out<<"_terminal_velocity_base "<<_terminal_velocity_base<<"\n";
00104 out.width(indent+2); out<<""; out<<"_terminal_velocity_spread "<<_terminal_velocity_spread<<"\n";
00105
00106 #endif //] NDEBUG
00107 }