00001 // Filename: zSpinParticleFactory.cxx 00002 // Created by: charles (16Aug00) 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 "zSpinParticleFactory.h" 00020 #include "zSpinParticle.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Function : ZSpinParticleFactory 00024 // Access : public 00025 // Description : constructor 00026 //////////////////////////////////////////////////////////////////// 00027 ZSpinParticleFactory:: 00028 ZSpinParticleFactory(void) : 00029 BaseParticleFactory() { 00030 _initial_angle = 0.0f; 00031 _final_angle = 0.0f; 00032 _initial_angle_spread = 0.0f; 00033 _final_angle_spread = 0.0f; 00034 _angular_velocity = 0.0f; 00035 _angular_velocity_spread = 0.0f; 00036 _bUseAngularVelocity = false; 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function : ZSpinParticleFactory 00041 // Access : public 00042 // Description : copy constructor 00043 //////////////////////////////////////////////////////////////////// 00044 ZSpinParticleFactory:: 00045 ZSpinParticleFactory(const ZSpinParticleFactory ©) : 00046 BaseParticleFactory(copy) { 00047 _initial_angle = copy._initial_angle; 00048 _final_angle = copy._final_angle; 00049 _initial_angle_spread = copy._initial_angle_spread; 00050 _final_angle_spread = copy._final_angle_spread; 00051 _angular_velocity = copy._angular_velocity; 00052 _angular_velocity_spread = copy._angular_velocity_spread; 00053 _bUseAngularVelocity = copy._bUseAngularVelocity; 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function : ~ZSpinParticleFactory 00058 // Access : virtual, public 00059 // Description : destructor 00060 //////////////////////////////////////////////////////////////////// 00061 ZSpinParticleFactory:: 00062 ~ZSpinParticleFactory(void) { 00063 } 00064 00065 //////////////////////////////////////////////////////////////////// 00066 // Function : alloc_particle 00067 // Access : private, virtual 00068 // Description : factory method 00069 //////////////////////////////////////////////////////////////////// 00070 BaseParticle *ZSpinParticleFactory:: 00071 alloc_particle(void) const { 00072 return new ZSpinParticle; 00073 } 00074 00075 //////////////////////////////////////////////////////////////////// 00076 // Function : populate_child_particle 00077 // Access : private, virtual 00078 // Description : factory populator 00079 //////////////////////////////////////////////////////////////////// 00080 void ZSpinParticleFactory:: 00081 populate_child_particle(BaseParticle *bp) const { 00082 ZSpinParticle *zsp = (ZSpinParticle *) bp; 00083 00084 zsp->set_initial_angle(_initial_angle + SPREAD(_initial_angle_spread)); 00085 zsp->set_final_angle(_final_angle + SPREAD(_final_angle_spread)); 00086 zsp->set_angular_velocity(_angular_velocity + SPREAD(_angular_velocity_spread)); 00087 zsp->enable_angular_velocity(_bUseAngularVelocity); 00088 }