Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/particles/particle_emitter.h @ 9869

Last change on this file since 9869 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 3.1 KB
RevLine 
[4597]1/*!
[5039]2 * @file particle_emitter.h
[4836]3  *  Definition of a ParticleEmitter
[3926]4*/
5
6#ifndef _PARTICLE_EMITTER_H
7#define _PARTICLE_EMITTER_H
8
9#include "p_node.h"
10
[5405]11// FORWARD DECLARATION
[3926]12class ParticleSystem;
[4437]13class TiXmlElement;
[3926]14
[4726]15// Default values
16#define PARTICLE_EMITTER_DEFAULT_SIZE              1.0
17#define PARTICLE_EMITTER_DEFAULT_EMISSION_RATE     50
18#define PARTICLE_EMITTER_DEFAULT_INHERIT_SPEED     0.0
19#define PARTICLE_EMITTER_DEFAULT_SPREAD            M_PI
[6825]20#define PARTICLE_EMITTER_DEFAULT_VELOCITY          1.0
[4726]21
[4381]22//! A class to handle an Emitter.
[6619]23class ParticleEmitter : public PNode
24{
[9715]25  ObjectListDeclaration(ParticleEmitter);
[6619]26  friend class ParticleSystem;
27public:
[6825]28  ParticleEmitter(float emissionRate = PARTICLE_EMITTER_DEFAULT_EMISSION_RATE,
29                  float velocity = PARTICLE_EMITTER_DEFAULT_VELOCITY,
30                  float angle = PARTICLE_EMITTER_DEFAULT_SPREAD);
[4746]31  virtual ~ParticleEmitter();
[4597]32
[6822]33  virtual void loadParams(const TiXmlElement* root = NULL);
[3926]34
[3929]35  /* controlling the emitter: interface */
[3927]36  void start();
37  void stop();
[6620]38  void tick(float dt);
[3927]39
[6619]40  void setSystem(ParticleSystem* system);
41  ParticleSystem* getSystem() const { return this->system; };
42
[3929]43  /* controlling the behavour: these can be used as Animation interfaces */
[3931]44  void setEmissionRate(float emissionRate);
[4493]45  void setInheritSpeed(float value);
[3931]46  void setSpread(float angle, float randomAngle = 0.0);
[4338]47  void setEmissionVelocity(float velocity, float randomVelocity = 0.0);
[4690]48  void setEmissionMomentum(float momentum, float randomMomentum = 0.0);
[3929]49
[4836]50  /** @returns the emissionRate */
[4746]51  inline float getEmissionRate() const { return this->emissionRate; };
[4836]52  /** @returns the inherit-speed-factor */
[4746]53  inline float getInheritSpeed() const { return this->inheritSpeed; };
[4836]54  /** @returns the SpreadAngle of the emitter */
[4746]55  inline float getSpread() const { return this->angle; };
[4836]56  /** @returns the EmissionVelocity of the emitter */
[4746]57  inline float getEmissionVelocity() const { return this->velocity; };
[4836]58  /** @returns the EmissionMomentum of this emitter */
[4746]59  inline float getEmissionMomentum() const { return this->momentum; };
[4338]60
[6822]61
[4746]62  void debug() const;
[3944]63
[6822]64protected:
[6825]65  virtual void emitParticles(unsigned int count) const = 0;
[6619]66
[6825]67protected:
[4690]68  float           inheritSpeed;      //!< How much speed the particle inherits from the Emitters speed.
[4478]69  float           angle;             //!< max angle from the direction of the emitter
70  float           randomAngle;       //!< random emission angle (angle +- angleRandom is the emitted angle.
71  float           velocity;          //!< the initial speed of a Particles.
72  float           randomVelocity;    //!< the random variation from the initial Speed.
[4690]73  float           momentum;          //!< The Initial spped of the Rotation.
74  float           momentumRandom;    //!< The random variation of the Momentum.
[3932]75
[6822]76private:
77  ParticleSystem* system;            //!< The ParticleSystem this Emitter Emits into.
[4478]78  float           saveTime;          //!< The time that was missing by the last Tick (otherwise there would be no emission when framefate is too big).
[6822]79  float           emissionRate;      //!< amount of particles per seconds emitted by emitter.
[3926]80};
81
82#endif /* _PARTICLE_EMITTER_H */
Note: See TracBrowser for help on using the repository browser.