Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6822 in orxonox.OLD for trunk/src/lib/particles/particle_emitter.h


Ignore:
Timestamp:
Jan 29, 2006, 1:57:03 AM (19 years ago)
Author:
bensch
Message:

trunk: ParticleEmitters now splitted into SubClasses.
Also fixed a little Boeg in the ClassID

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/particles/particle_emitter.h

    r6620 r6822  
    1616#define PARTICLE_EMITTER_DEFAULT_SIZE              1.0
    1717#define PARTICLE_EMITTER_DEFAULT_EMISSION_RATE     50
    18 #define PARTICLE_EMITTER_DEFAULT_TYPE              EMITTER_DOT
    1918#define PARTICLE_EMITTER_DEFAULT_INHERIT_SPEED     0.0
    2019#define PARTICLE_EMITTER_DEFAULT_SPREAD            M_PI
    21 
    22 //! The form of the Emitter to emit from
    23 typedef enum EMITTER_TYPE
    24 {
    25   EMITTER_DOT     = 1,
    26   EMITTER_PLANE   = 2,
    27   EMITTER_SPHERE  = 4,
    28   EMITTER_CUBE    = 8
    29 };
    3020
    3121//! A class to handle an Emitter.
     
    3424  friend class ParticleSystem;
    3525public:
    36   ParticleEmitter(const Vector& direction, float angle = .5,
     26  ParticleEmitter(const Vector& direction = Vector(1.0,0.0,0.0) , float angle = .5,
    3727                  float emissionRate = 1.0, float velocity = 1.0);
    38   ParticleEmitter(const TiXmlElement* root);
    3928  virtual ~ParticleEmitter();
    4029
    41   void init();
    42   virtual void loadParams(const TiXmlElement* root);
     30  virtual void loadParams(const TiXmlElement* root = NULL);
    4331
    4432  /* controlling the emitter: interface */
     
    5139
    5240  /* 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);
    5641  void setEmissionRate(float emissionRate);
    5742  void setInheritSpeed(float value);
     
    6045  void setEmissionMomentum(float momentum, float randomMomentum = 0.0);
    6146
    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
    6448
    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; };
    7149  /** @returns the emissionRate */
    7250  inline float getEmissionRate() const { return this->emissionRate; };
     
    8058  inline float getEmissionMomentum() const { return this->momentum; };
    8159
     60  virtual void emitParticles(unsigned int count) const = 0;
     61
    8262  void debug() const;
    8363
     64protected:
    8465
    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).
    9066  float           inheritSpeed;      //!< How much speed the particle inherits from the Emitters speed.
    9167  Vector          direction;         //!< emition direction.
    9268  float           angle;             //!< max angle from the direction of the emitter
    9369  float           randomAngle;       //!< random emission angle (angle +- angleRandom is the emitted angle.
    94   float           emissionRate;      //!< amount of particles per seconds emitted by emitter.
    9570  float           velocity;          //!< the initial speed of a Particles.
    9671  float           randomVelocity;    //!< the random variation from the initial Speed.
     
    9873  float           momentumRandom;    //!< The random variation of the Momentum.
    9974
     75private:
     76  ParticleSystem* system;            //!< The ParticleSystem this Emitter Emits into.
    10077  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.
    10179};
    10280
Note: See TracChangeset for help on using the changeset viewer.