1 | /*! |
---|
2 | \file particle_engine.h |
---|
3 | \brief Definition of the ParticleEngine |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _PARTICLE_ENGINE_H |
---|
7 | #define _PARTICLE_ENGINE_H |
---|
8 | |
---|
9 | #include "base_object.h" |
---|
10 | #include "particle_system.h" |
---|
11 | #include "particle_emitter.h" |
---|
12 | |
---|
13 | // FORWARD DEFINITION |
---|
14 | template<class T> class tList; |
---|
15 | |
---|
16 | struct ParticleConnection |
---|
17 | { |
---|
18 | ParticleEmitter* emitter; //!< The emitter to emit system from. |
---|
19 | ParticleSystem* system; //!< The Particles emitted from emitter. |
---|
20 | }; |
---|
21 | |
---|
22 | //! The physicsEngine handles and stores Systems and Emitters. |
---|
23 | /** |
---|
24 | It is responsible for driving on the Particles (tick) |
---|
25 | It draw particles (draw) |
---|
26 | and it emitts particles into the system |
---|
27 | */ |
---|
28 | class ParticleEngine : public BaseObject { |
---|
29 | |
---|
30 | public: |
---|
31 | static ParticleEngine* getInstance(void); |
---|
32 | virtual ~ParticleEngine(void); |
---|
33 | |
---|
34 | void tick(float dt); |
---|
35 | void draw(void) const; |
---|
36 | |
---|
37 | void addSystem(ParticleSystem* system); |
---|
38 | void addEmitter(ParticleEmitter* emitter); |
---|
39 | void addConnection(ParticleEmitter* emitter, ParticleSystem* system); |
---|
40 | |
---|
41 | bool removeSystem(ParticleSystem* system); |
---|
42 | bool removeEmitter(ParticleEmitter* emitter); |
---|
43 | bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system); |
---|
44 | bool breakConnection(ParticleConnection* connection); |
---|
45 | |
---|
46 | ParticleSystem* getSystemByName(const char* systemName) const; |
---|
47 | ParticleSystem* getSystemByNumber(unsigned int number) const; |
---|
48 | ParticleEmitter* getEmitterByName(const char* emitterName) const; |
---|
49 | ParticleEmitter* getEmitterByNumber(unsigned int number) const; |
---|
50 | |
---|
51 | void debug(); |
---|
52 | |
---|
53 | private: |
---|
54 | ParticleEngine(void); |
---|
55 | static ParticleEngine* singletonRef; //!< The reference to the engine. |
---|
56 | |
---|
57 | tList<ParticleSystem>* systemList; //!< A list of Systems handled by the ParticleEngine. |
---|
58 | tList<ParticleEmitter>* emitterList; //!< A list of Emitters handled by the ParticleEngine. |
---|
59 | |
---|
60 | tList<ParticleConnection>* connectionList; //!< A list of Connections between Systems and Emitters. |
---|
61 | }; |
---|
62 | |
---|
63 | #endif /* _PARTICLE_ENGINE_H */ |
---|