Changeset 6822 in orxonox.OLD for trunk/src/lib/particles/particle_emitter.h
- Timestamp:
- Jan 29, 2006, 1:57:03 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/particles/particle_emitter.h
r6620 r6822 16 16 #define PARTICLE_EMITTER_DEFAULT_SIZE 1.0 17 17 #define PARTICLE_EMITTER_DEFAULT_EMISSION_RATE 50 18 #define PARTICLE_EMITTER_DEFAULT_TYPE EMITTER_DOT19 18 #define PARTICLE_EMITTER_DEFAULT_INHERIT_SPEED 0.0 20 19 #define PARTICLE_EMITTER_DEFAULT_SPREAD M_PI 21 22 //! The form of the Emitter to emit from23 typedef enum EMITTER_TYPE24 {25 EMITTER_DOT = 1,26 EMITTER_PLANE = 2,27 EMITTER_SPHERE = 4,28 EMITTER_CUBE = 829 };30 20 31 21 //! A class to handle an Emitter. … … 34 24 friend class ParticleSystem; 35 25 public: 36 ParticleEmitter(const Vector& direction , float angle = .5,26 ParticleEmitter(const Vector& direction = Vector(1.0,0.0,0.0) , float angle = .5, 37 27 float emissionRate = 1.0, float velocity = 1.0); 38 ParticleEmitter(const TiXmlElement* root);39 28 virtual ~ParticleEmitter(); 40 29 41 void init(); 42 virtual void loadParams(const TiXmlElement* root); 30 virtual void loadParams(const TiXmlElement* root = NULL); 43 31 44 32 /* controlling the emitter: interface */ … … 51 39 52 40 /* controlling the behavour: these can be used as Animation interfaces */ 53 void setType(EMITTER_TYPE type);54 void setType(const char* type);55 void setSize(float emitterSize);56 41 void setEmissionRate(float emissionRate); 57 42 void setInheritSpeed(float value); … … 60 45 void setEmissionMomentum(float momentum, float randomMomentum = 0.0); 61 46 62 void setDirection(float x, float y, float z) { this->direction = Vector(x,y,z); } 63 ; //!< todo this should be done via PNODE 47 void setDirection(float x, float y, float z) { this->direction = Vector(x,y,z); }; //!< todo this should be done via PNODE 64 48 65 /** @returns the type of the emitter */66 inline EMITTER_TYPE getType() const { return this->type; };67 /** @returns the Type as a const char * */68 const char* getTypeC() const;69 /** @returns the Size of the emitter */70 inline float getSize() const { return this->emitterSize; };71 49 /** @returns the emissionRate */ 72 50 inline float getEmissionRate() const { return this->emissionRate; }; … … 80 58 inline float getEmissionMomentum() const { return this->momentum; }; 81 59 60 virtual void emitParticles(unsigned int count) const = 0; 61 82 62 void debug() const; 83 63 64 protected: 84 65 85 private:86 ParticleSystem* system; //!< The ParticleSystem this Emitter Emits into.87 88 EMITTER_TYPE type; //!< The type of emitter this is.89 float emitterSize; //!< The size of the emitter (not for EMITTER_DOT).90 66 float inheritSpeed; //!< How much speed the particle inherits from the Emitters speed. 91 67 Vector direction; //!< emition direction. 92 68 float angle; //!< max angle from the direction of the emitter 93 69 float randomAngle; //!< random emission angle (angle +- angleRandom is the emitted angle. 94 float emissionRate; //!< amount of particles per seconds emitted by emitter.95 70 float velocity; //!< the initial speed of a Particles. 96 71 float randomVelocity; //!< the random variation from the initial Speed. … … 98 73 float momentumRandom; //!< The random variation of the Momentum. 99 74 75 private: 76 ParticleSystem* system; //!< The ParticleSystem this Emitter Emits into. 100 77 float saveTime; //!< The time that was missing by the last Tick (otherwise there would be no emission when framefate is too big). 78 float emissionRate; //!< amount of particles per seconds emitted by emitter. 101 79 }; 102 80
Note: See TracChangeset
for help on using the changeset viewer.