Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/particles/particle_emitter.h @ 4677

Last change on this file since 4677 was 4639, checked in by bensch, 19 years ago

orxonox/trunk: particleFun draws some Particles again

File size: 3.0 KB
RevLine 
[4597]1/*!
[4381]2    \file particle_emitter.h
[3926]3    \brief Definition of a ParticleEmitter
4*/
5
6#ifndef _PARTICLE_EMITTER_H
7#define _PARTICLE_EMITTER_H
8
9#include "p_node.h"
10
[4597]11// FORWARD DEFINITION
[3926]12class ParticleSystem;
[4437]13class TiXmlElement;
[3926]14
[4338]15//! The form of the Emitter to emit from
[4597]16  typedef enum EMITTER_TYPE
17{
18  EMITTER_DOT     = 1,
19  EMITTER_PLANE   = 2,
20  EMITTER_SPHERE  = 4,
21  EMITTER_CUBE    = 8
22};
[3926]23
[4381]24//! A class to handle an Emitter.
[3926]25class ParticleEmitter : public PNode {
26
27 public:
[4176]28  ParticleEmitter(const Vector& direction, float angle = .5,
[4597]29                  float emissionRate = 1.0, float velocity = 1.0);
[4437]30  ParticleEmitter(const TiXmlElement* root);
[3926]31  virtual ~ParticleEmitter(void);
[4597]32
[4437]33  void loadParams(const TiXmlElement* root);
[3926]34
[3929]35  /* controlling the emitter: interface */
[3927]36  void start();
37  void stop();
[3932]38  void tick(float dt, ParticleSystem* system);
[3927]39
[3929]40  /* controlling the behavour: these can be used as Animation interfaces */
[4338]41  void setType(EMITTER_TYPE type);
[4437]42  void setType(const char* type);
[4338]43  void setSize(float emitterSize);
[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);
[3929]48
[4338]49  /** \returns the type of the emitter */
50  inline EMITTER_TYPE getType(void) const { return this->type; };
[4639]51  /** \returns the Type as a const char * */
52  const char* getTypeC(void) const;
[4338]53  /** \returns the Size of the emitter */
54  inline float getSize(void) const { return this->emitterSize; };
55  /** \returns the emissionRate */
56  inline float getEmissionRate(void) const { return this->emissionRate; };
[4493]57  /** \returns the inherit-speed-factor */
58  inline float getInheritSpeed(void) const { return this->inheritSpeed; };
[4338]59  /** \returns the SpreadAngle of the emitter */
[4639]60  inline float getSpread(void) const { return this->angle; };
[4338]61  /** \returns the EmissionVelocity of the emitter */
[4639]62  inline float getEmissionVelocity(void) const { return this->velocity; };
[4338]63
[4639]64  void debug(void) const;
[3944]65
[4478]66
[3926]67 private:
[4478]68  EMITTER_TYPE    type;              //!< The type of emitter this is
69  float           emitterSize;       //!< The size of the emitter (not for EMITTER_DOT)
[4493]70  float           inheritSpeed;      //!< How much speed the particle inherits from the Emitters speed \todo move this to the emitter
[4478]71  Vector          direction;         //!< emition direction
72  float           angle;             //!< max angle from the direction of the emitter
73  float           randomAngle;       //!< random emission angle (angle +- angleRandom is the emitted angle.
74  float           emissionRate;      //!< amount of particles per seconds emitted by emitter.
75  float           velocity;          //!< the initial speed of a Particles.
76  float           randomVelocity;    //!< the random variation from the initial Speed.
[3932]77
[4478]78  float           saveTime;          //!< The time that was missing by the last Tick (otherwise there would be no emission when framefate is too big).
[3926]79};
80
81#endif /* _PARTICLE_EMITTER_H */
Note: See TracBrowser for help on using the repository browser.