Panda3D
|
00001 // Filename: baseParticleFactory.h 00002 // Created by: charles (05Jul00) 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 #ifndef BASEPARTICLEFACTORY_H 00016 #define BASEPARTICLEFACTORY_H 00017 00018 #include "pandabase.h" 00019 #include "referenceCount.h" 00020 00021 #include "baseParticle.h" 00022 #include "particleCommonFuncs.h" 00023 00024 #include <stdlib.h> 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : BaseParticleFactory 00028 // Description : Pure Virtual base class for creating particles 00029 //////////////////////////////////////////////////////////////////// 00030 class EXPCL_PANDAPHYSICS BaseParticleFactory : public ReferenceCount { 00031 PUBLISHED: 00032 virtual ~BaseParticleFactory(); 00033 00034 INLINE void set_lifespan_base(PN_stdfloat lb); 00035 INLINE void set_lifespan_spread(PN_stdfloat ls); 00036 INLINE void set_mass_base(PN_stdfloat mb); 00037 INLINE void set_mass_spread(PN_stdfloat ms); 00038 INLINE void set_terminal_velocity_base(PN_stdfloat tvb); 00039 INLINE void set_terminal_velocity_spread(PN_stdfloat tvs); 00040 00041 INLINE PN_stdfloat get_lifespan_base() const; 00042 INLINE PN_stdfloat get_lifespan_spread() const; 00043 INLINE PN_stdfloat get_mass_base() const; 00044 INLINE PN_stdfloat get_mass_spread() const; 00045 INLINE PN_stdfloat get_terminal_velocity_base() const; 00046 INLINE PN_stdfloat get_terminal_velocity_spread() const; 00047 00048 virtual BaseParticle *alloc_particle() const = 0; 00049 00050 void populate_particle(BaseParticle* bp); 00051 00052 virtual void output(ostream &out) const; 00053 virtual void write(ostream &out, int indent=0) const; 00054 00055 protected: 00056 BaseParticleFactory(); 00057 BaseParticleFactory(const BaseParticleFactory ©); 00058 00059 private: 00060 PN_stdfloat _lifespan_base; 00061 PN_stdfloat _lifespan_spread; 00062 00063 PN_stdfloat _mass_base; 00064 PN_stdfloat _mass_spread; 00065 00066 PN_stdfloat _terminal_velocity_base; 00067 PN_stdfloat _terminal_velocity_spread; 00068 00069 virtual void populate_child_particle(BaseParticle *bp) const = 0; 00070 }; 00071 00072 #include "baseParticleFactory.I" 00073 00074 #endif // BASEPARTICLEFACTORY_H