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 | //! A ParticleConnection enables us to emitt from any emitter into any other particleSystem |
---|
17 | typedef struct ParticleConnection |
---|
18 | { |
---|
19 | ParticleEmitter* emitter; //!< The emitter to emit system from. |
---|
20 | ParticleSystem* system; //!< The Particles emitted from emitter. |
---|
21 | }; |
---|
22 | |
---|
23 | //! The physicsEngine handles and stores Systems and Emitters. |
---|
24 | /** |
---|
25 | It is responsible for driving on the Particles (tick) |
---|
26 | It draw particles (draw) |
---|
27 | and it emitts particles into the system |
---|
28 | */ |
---|
29 | class ParticleEngine : public BaseObject { |
---|
30 | |
---|
31 | public: |
---|
32 | static ParticleEngine* getInstance(void); |
---|
33 | virtual ~ParticleEngine(void); |
---|
34 | |
---|
35 | void tick(float dt); |
---|
36 | void draw(void) const; |
---|
37 | |
---|
38 | void addSystem(ParticleSystem* system); |
---|
39 | void addEmitter(ParticleEmitter* emitter); |
---|
40 | void addConnection(ParticleEmitter* emitter, ParticleSystem* system); |
---|
41 | |
---|
42 | bool removeSystem(ParticleSystem* system); |
---|
43 | bool removeEmitter(ParticleEmitter* emitter); |
---|
44 | bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system); |
---|
45 | bool breakConnection(ParticleConnection* connection); |
---|
46 | |
---|
47 | ParticleSystem* getSystemByName(const char* systemName) const; |
---|
48 | ParticleSystem* getSystemByNumber(unsigned int number) const; |
---|
49 | ParticleEmitter* getEmitterByName(const char* emitterName) const; |
---|
50 | ParticleEmitter* getEmitterByNumber(unsigned int number) const; |
---|
51 | |
---|
52 | void debug(); |
---|
53 | |
---|
54 | private: |
---|
55 | ParticleEngine(void); |
---|
56 | static ParticleEngine* singletonRef; //!< The reference to the engine. |
---|
57 | |
---|
58 | tList<ParticleSystem>* systemList; //!< A list of Systems handled by the ParticleEngine. |
---|
59 | tList<ParticleEmitter>* emitterList; //!< A list of Emitters handled by the ParticleEngine. |
---|
60 | |
---|
61 | tList<ParticleConnection>* connectionList; //!< A list of Connections between Systems and Emitters. |
---|
62 | }; |
---|
63 | |
---|
64 | #endif /* _PARTICLE_ENGINE_H */ |
---|