Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6822 in orxonox.OLD for trunk/src/lib/particles/dot_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 copied

Legend:

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

    r6820 r6822  
    11/*!
    2  * @file particle_emitter.h
    3   *  Definition of a ParticleEmitter
    4 */
     2 * @file dot_emitter.h
     3 *  Definition of a DotEmitter
     4 */
    55
    6 #ifndef _PARTICLE_EMITTER_H
    7 #define _PARTICLE_EMITTER_H
     6#ifndef _DOT_EMITTER_H
     7#define _DOT_EMITTER_H
    88
    9 #include "p_node.h"
    10 
    11 // FORWARD DECLARATION
    12 class ParticleSystem;
    13 class TiXmlElement;
     9#include "particle_emitter.h"
    1410
    1511// Default values
    16 #define PARTICLE_EMITTER_DEFAULT_SIZE              1.0
    17 #define PARTICLE_EMITTER_DEFAULT_EMISSION_RATE     50
    18 #define PARTICLE_EMITTER_DEFAULT_TYPE              EMITTER_DOT
    19 #define PARTICLE_EMITTER_DEFAULT_INHERIT_SPEED     0.0
    20 #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 };
     12#define DOT_EMITTER_DEFAULT_SIZE              1.0
    3013
    3114//! A class to handle an Emitter.
    32 class ParticleEmitter : public PNode
     15class DotEmitter : public ParticleEmitter
    3316{
    3417  friend class ParticleSystem;
    3518public:
    36   ParticleEmitter(const Vector& direction, float angle = .5,
    37                   float emissionRate = 1.0, float velocity = 1.0);
    38   ParticleEmitter(const TiXmlElement* root);
    39   virtual ~ParticleEmitter();
     19  DotEmitter(const Vector& direction, float angle = .5,
     20             float emissionRate = 1.0, float velocity = 1.0);
     21  DotEmitter(const TiXmlElement* root);
     22  virtual ~DotEmitter();
    4023
    41   void init();
    42   virtual void loadParams(const TiXmlElement* root);
    4324
    4425  /* controlling the emitter: interface */
    45   void start();
    46   void stop();
    4726  void tick(float dt);
    4827
    49   void setSystem(ParticleSystem* system);
    50   ParticleSystem* getSystem() const { return this->system; };
    51 
    52   /* 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   void setEmissionRate(float emissionRate);
    57   void setInheritSpeed(float value);
    58   void setSpread(float angle, float randomAngle = 0.0);
    59   void setEmissionVelocity(float velocity, float randomVelocity = 0.0);
    60   void setEmissionMomentum(float momentum, float randomMomentum = 0.0);
    61 
    62   void setDirection(float x, float y, float z) { this->direction = Vector(x,y,z); }
    63   ; //!< todo this should be done via PNODE
    64 
    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   /** @returns the emissionRate */
    72   inline float getEmissionRate() const { return this->emissionRate; };
    73   /** @returns the inherit-speed-factor */
    74   inline float getInheritSpeed() const { return this->inheritSpeed; };
    75   /** @returns the SpreadAngle of the emitter */
    76   inline float getSpread() const { return this->angle; };
    77   /** @returns the EmissionVelocity of the emitter */
    78   inline float getEmissionVelocity() const { return this->velocity; };
    79   /** @returns the EmissionMomentum of this emitter */
    80   inline float getEmissionMomentum() const { return this->momentum; };
    81 
    82   void debug() const;
    83 
     28  virtual void emitParticles(unsigned int count) const;
    8429
    8530private:
    86   ParticleSystem* system;            //!< The ParticleSystem this Emitter Emits into.
     31  void init();
    8732
    88   EMITTER_TYPE    type;              //!< The type of emitter this is.
    89   float           emitterSize;       //!< The size of the emitter (not for EMITTER_DOT).
    90   float           inheritSpeed;      //!< How much speed the particle inherits from the Emitters speed.
    91   Vector          direction;         //!< emition direction.
    92   float           angle;             //!< max angle from the direction of the emitter
    93   float           randomAngle;       //!< random emission angle (angle +- angleRandom is the emitted angle.
    94   float           emissionRate;      //!< amount of particles per seconds emitted by emitter.
    95   float           velocity;          //!< the initial speed of a Particles.
    96   float           randomVelocity;    //!< the random variation from the initial Speed.
    97   float           momentum;          //!< The Initial spped of the Rotation.
    98   float           momentumRandom;    //!< The random variation of the Momentum.
     33private:
     34  Vector          emitterSize;       //!< The size of the emitter (not for EMITTER_DOT).
    9935
    100   float           saveTime;          //!< The time that was missing by the last Tick (otherwise there would be no emission when framefate is too big).
    10136};
    10237
    103 #endif /* _PARTICLE_EMITTER_H */
     38#endif /* _DOT_EMITTER_H */
Note: See TracChangeset for help on using the changeset viewer.