Panda3D
|
00001 // Filename: baseParticleEmitter.h 00002 // Created by: charles (14Jun00) 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 BASEPARTICLEEMITTER_H 00016 #define BASEPARTICLEEMITTER_H 00017 00018 #include "pandabase.h" 00019 #include "referenceCount.h" 00020 #include "luse.h" 00021 00022 #include "particleCommonFuncs.h" 00023 00024 #include "mathNumbers.h" 00025 00026 ////////////////////////////////////////////////////////////// ////// 00027 // Class : BaseParticleEmitter 00028 // Description : Describes a physical region in space in which 00029 // particles are randomly generated. 00030 //////////////////////////////////////////////////////////////////// 00031 class EXPCL_PANDAPHYSICS BaseParticleEmitter : public ReferenceCount { 00032 PUBLISHED: 00033 enum emissionType { 00034 ET_EXPLICIT, // all particles are emitted in parallel along the same vector 00035 ET_RADIATE, // all particles radiate away from a single point 00036 ET_CUSTOM // particle launch vectors are dependent on particular derived emitter 00037 }; 00038 00039 virtual ~BaseParticleEmitter(); 00040 virtual BaseParticleEmitter *make_copy() = 0; 00041 00042 void generate(LPoint3& pos, LVector3& vel); 00043 00044 INLINE void set_emission_type(emissionType et); 00045 INLINE void set_amplitude(PN_stdfloat a); 00046 INLINE void set_amplitude_spread(PN_stdfloat as); 00047 INLINE void set_offset_force(const LVector3& of); // this is a constant force applied to all particles 00048 INLINE void set_explicit_launch_vector(const LVector3& elv); 00049 INLINE void set_radiate_origin(const LPoint3& ro); 00050 00051 INLINE emissionType get_emission_type() const; 00052 INLINE PN_stdfloat get_amplitude() const; 00053 INLINE PN_stdfloat get_amplitude_spread() const; 00054 INLINE LVector3 get_offset_force() const; 00055 INLINE LVector3 get_explicit_launch_vector() const; 00056 INLINE LPoint3 get_radiate_origin() const; 00057 00058 virtual void output(ostream &out) const; 00059 virtual void write(ostream &out, int indent=0) const; 00060 00061 protected: 00062 BaseParticleEmitter(); 00063 BaseParticleEmitter(const BaseParticleEmitter ©); 00064 00065 emissionType _emission_type; 00066 LVector3 _explicit_launch_vector; 00067 LPoint3 _radiate_origin; 00068 00069 PN_stdfloat _amplitude; 00070 PN_stdfloat _amplitude_spread; 00071 00072 private: 00073 // these should be called in sequence (pos, then vel) 00074 virtual void assign_initial_position(LPoint3& pos) = 0; 00075 virtual void assign_initial_velocity(LVector3& vel) = 0; 00076 00077 LVector3 _offset_force; 00078 }; 00079 00080 #include "baseParticleEmitter.I" 00081 00082 #endif // BASEPARTICLEEMITTER_H