Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4428 was 4381, checked in by bensch, 20 years ago

orxonox/trunk: made include more local. stdincl.h not in base_object.h anymore

File size: 2.3 KB
Line 
1/*!
2    \file particle_emitter.h
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
11// FORWARD DEFINITION
12struct Particle;
13class ParticleSystem;
14
15//! The form of the Emitter to emit from
16typedef enum EMITTER_TYPE {EMITTER_DOT   = 1,
17                           EMITTER_PLANE = 2,
18                           EMITTER_SPHERE= 4,
19                           EMITTER_CUBE  = 8};
20
21//! A class to handle an Emitter.
22class ParticleEmitter : public PNode {
23
24 public:
25  ParticleEmitter(const Vector& direction, float angle = .5,
26                  float emissionRate = 1.0, float velocity = 1.0);
27  virtual ~ParticleEmitter(void);
28
29  /* controlling the emitter: interface */
30  void start();
31  void stop();
32  void tick(float dt, ParticleSystem* system);
33
34  /* controlling the behavour: these can be used as Animation interfaces */
35  void setType(EMITTER_TYPE type);
36  void setSize(float emitterSize);
37  void setEmissionRate(float emissionRate);
38  void setSpread(float angle, float randomAngle = 0.0);
39  void setEmissionVelocity(float velocity, float randomVelocity = 0.0);
40
41  /** \returns the type of the emitter */
42  inline EMITTER_TYPE getType(void) const { return this->type; };
43  /** \returns the Size of the emitter */
44  inline float getSize(void) const { return this->emitterSize; };
45  /** \returns the emissionRate */
46  inline float getEmissionRate(void) const { return this->emissionRate; };
47  /** \returns the SpreadAngle of the emitter */
48  inline float getSpread(void) { return this->angle; };
49  /** \returns the EmissionVelocity of the emitter */
50  inline float getEmissionVelocity(void) { return this->velocity; };
51
52  void debug(void);
53
54 private:
55  EMITTER_TYPE type;    //!< The type of emitter this is
56  float emitterSize;    //!< The size of the emitter (not for EMITTER_DOT)
57  Vector direction;     //!< emition direction
58  float angle;          //!< max angle from the direction of the emitter
59  float randomAngle;    //!< random emission angle (angle +- angleRandom is the emitted angle.
60  float emissionRate;   //!< amount of particles per seconds emitted by emitter.
61  float velocity;       //!< the initial speed of a Particles.
62  float randomVelocity; //!< the random variation from the initial Speed.
63
64  float saveTime;       //!< The time that was missing by the last Tick (otherwise there would be no emission when framefate is too big).
65};
66
67#endif /* _PARTICLE_EMITTER_H */
Note: See TracBrowser for help on using the repository browser.