00001 // Filename: baseParticleFactory.cxx 00002 // Created by: charles (05Jul00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "baseParticleFactory.h" 00020 00021 //////////////////////////////////////////////////////////////////// 00022 // Function : BaseParticleFactory 00023 // Access : protected 00024 // Description : constructor 00025 //////////////////////////////////////////////////////////////////// 00026 BaseParticleFactory:: 00027 BaseParticleFactory(void) { 00028 _mass_base = 1.0f; 00029 _mass_spread = 0.0f; 00030 00031 _terminal_velocity_base = PhysicsObject::_default_terminal_velocity; 00032 _terminal_velocity_spread = 0.0f; 00033 00034 _lifespan_base = 1.0f; 00035 _lifespan_spread = 0.0f; 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function : BaseParticleFactory 00040 // Access : protected 00041 // Description : copy constructor 00042 //////////////////////////////////////////////////////////////////// 00043 BaseParticleFactory:: 00044 BaseParticleFactory(const BaseParticleFactory ©) { 00045 _terminal_velocity_base = copy._terminal_velocity_base; 00046 _terminal_velocity_spread = copy._terminal_velocity_spread; 00047 _lifespan_base = copy._lifespan_base; 00048 _lifespan_spread = copy._lifespan_spread; 00049 } 00050 00051 //////////////////////////////////////////////////////////////////// 00052 // Function : ~BaseParticleFactory 00053 // Access : public virtual 00054 // Description : destructor 00055 //////////////////////////////////////////////////////////////////// 00056 BaseParticleFactory:: 00057 ~BaseParticleFactory(void) { 00058 } 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function : make_particle 00062 // Description : public 00063 //////////////////////////////////////////////////////////////////// 00064 void BaseParticleFactory:: 00065 populate_particle(BaseParticle *bp) { 00066 bp->set_lifespan(_lifespan_base + SPREAD(_lifespan_spread)); 00067 bp->set_mass(_mass_base + SPREAD(_mass_spread)); 00068 bp->set_terminal_velocity(_terminal_velocity_base + SPREAD(_terminal_velocity_spread)); 00069 00070 bp->set_active(false); 00071 bp->set_alive(false); 00072 bp->set_age(0.0f); 00073 00074 populate_child_particle(bp); 00075 }