1 | /*! |
---|
2 | * @file box_emitter.h |
---|
3 | * Definition of a BoxEmitter |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _BOX_EMITTER_H |
---|
7 | #define _BOX_EMITTER_H |
---|
8 | |
---|
9 | #include "particle_emitter.h" |
---|
10 | |
---|
11 | #define BOX_EMITTER_DEFAULT_SIZE Vector(1.0f, 1.0f, 1.0f) |
---|
12 | |
---|
13 | //! A class to handle a Box Emitter. |
---|
14 | /** |
---|
15 | * A Box Emitter is a special kind of emitter, that has the (underlying) PNode |
---|
16 | * at its center, and from there on is a Box in the Direction of the PNode |
---|
17 | * out around size in the corresponding directions |
---|
18 | */ |
---|
19 | class BoxEmitter : public ParticleEmitter |
---|
20 | { |
---|
21 | ObjectListDeclaration(BoxEmitter); |
---|
22 | friend class ParticleSystem; |
---|
23 | public: |
---|
24 | BoxEmitter(const Vector& size = BOX_EMITTER_DEFAULT_SIZE, |
---|
25 | float emissionRate = PARTICLE_EMITTER_DEFAULT_EMISSION_RATE, |
---|
26 | float velocity = PARTICLE_EMITTER_DEFAULT_VELOCITY, |
---|
27 | float angle = PARTICLE_EMITTER_DEFAULT_SPREAD); |
---|
28 | BoxEmitter(const TiXmlElement* root); |
---|
29 | virtual ~BoxEmitter(); |
---|
30 | |
---|
31 | virtual void loadParams(const TiXmlElement* root); |
---|
32 | |
---|
33 | void setSize(float x, float y, float z); |
---|
34 | void setSize(const Vector& size) { this->setSize(size.x, size.y, size.z); }; |
---|
35 | |
---|
36 | protected: |
---|
37 | virtual void emitParticles(unsigned int count) const; |
---|
38 | |
---|
39 | private: |
---|
40 | void init(); |
---|
41 | |
---|
42 | private: |
---|
43 | Vector size; |
---|
44 | }; |
---|
45 | |
---|
46 | #endif /* _BOX_EMITTER_H */ |
---|