lbm_reference
Emitter.h
Go to the documentation of this file.
1 //! \file Emitter.h
2 //! \date Mar 12, 2009
3 //! \author Florian Rathgeber
4 
5 #ifndef EMITTER_H_
6 #define EMITTER_H_
7 
8 #include <list>
9 
10 #include "Particle.h"
11 
12 //! Common namespace for all classes related to the particle system
13 
14 namespace particles {
15 
16 class ParticleSystem;
17 
18 //! Adds new particles to the particle system
19 
20 //! Particles are inserted at the emitter's position having a fixed initial
21 //! temperature and a lifetime depending on the emitter's current fuel value.
22 
23 class Emitter {
24 
25  //! Fried declaration to allow ParticleSystem class access to protected
26  //! members
27 
28  friend class ParticleSystem;
29 
30 public:
31 
32  // ============================ //
33  // Constructors and destructors //
34  // ============================ //
35 
36  //! Constructor
37 
38  //! \param[in] pos Position of the emitter (x,y,z)
39  //! \param[in] temp Initial temperature of emitted particles
40  //! \param[in] fuel Initial fuel value of the emitter
41  //! \param[in] emitThreshold Determines particle emission probability, the
42  //! higher the threshold the smaller
43  //! \param[in] fuelConsumption Factor by which fuel value is reduced every
44  //! time a particle is emitted
45  //! \param[in] lifetimeCoeff Coefficient to determine particle lifetime
46  //! based on emitters current fuel value
47 
48  Emitter ( core::vector3df pos,
49  core::vector3df size,
50  float temp,
51  int fuel,
52  int emitThreshold,
53  float fuelConsumption,
54  float lifetimeCoeff );
55 
56  //! Destructor
57 
58  //! Does nothing.
59 
60  virtual ~Emitter () {}
61 
62 protected:
63 
64  // ============ //
65  // Data members //
66  // ============ //
67 
68  //! List of particles the emitter has already emitted
69 
70  std::list< Particle > particles_;
71 
72  //! Position of the emitter (x,y,z)
73 
74  core::vector3df pos_;
75 
76  core::vector3df size_;
77 
78  //! Initial temperature of emitted particles
79 
80  float temp_;
81 
82  //! Current fuel value of the emitter
83 
84  int fuel_;
85 
86  //! Determines particle emission probability. The higher the threshold the
87  //! smaller the emission probability for each time step
88 
90 
91  //! Factor by which fuel value is reduced every time a particle is emitted
92 
94 
95  //! Coefficient to determine particle lifetime based on emitters current fuel
96  //! value
97 
99 };
100 
101 } // namespace particles
102 
103 #endif /* EMITTER_H_ */