[3655] | 1 | /*! |
---|
[3923] | 2 | \file particle_engine.h |
---|
| 3 | \brief Definition of the ParticleEngine |
---|
[3655] | 4 | */ |
---|
| 5 | |
---|
[3923] | 6 | #ifndef _PARTICLE_ENGINE_H |
---|
| 7 | #define _PARTICLE_ENGINE_H |
---|
[3655] | 8 | |
---|
| 9 | #include "base_object.h" |
---|
[4176] | 10 | #include "particle_system.h" |
---|
| 11 | #include "particle_emitter.h" |
---|
[3655] | 12 | |
---|
[3923] | 13 | // FORWARD DEFINITION |
---|
[3925] | 14 | template<class T> class tList; |
---|
[3655] | 15 | |
---|
[4478] | 16 | //! A ParticleConnection enables us to emitt from any emitter into any other particleSystem |
---|
| 17 | typedef struct ParticleConnection |
---|
[3931] | 18 | { |
---|
[4478] | 19 | ParticleEmitter* emitter; //!< The emitter to emit system from. |
---|
| 20 | ParticleSystem* system; //!< The Particles emitted from emitter. |
---|
[3931] | 21 | }; |
---|
[3925] | 22 | |
---|
[4394] | 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 | */ |
---|
[3923] | 29 | class ParticleEngine : public BaseObject { |
---|
[3655] | 30 | |
---|
| 31 | public: |
---|
[3923] | 32 | static ParticleEngine* getInstance(void); |
---|
| 33 | virtual ~ParticleEngine(void); |
---|
[3655] | 34 | |
---|
[3925] | 35 | void tick(float dt); |
---|
[4349] | 36 | void draw(void) const; |
---|
[3925] | 37 | |
---|
[3931] | 38 | void addSystem(ParticleSystem* system); |
---|
| 39 | void addEmitter(ParticleEmitter* emitter); |
---|
[3932] | 40 | void addConnection(ParticleEmitter* emitter, ParticleSystem* system); |
---|
[3931] | 41 | |
---|
| 42 | bool removeSystem(ParticleSystem* system); |
---|
| 43 | bool removeEmitter(ParticleEmitter* emitter); |
---|
[3943] | 44 | bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system); |
---|
| 45 | bool breakConnection(ParticleConnection* connection); |
---|
[3931] | 46 | |
---|
[4338] | 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 | |
---|
[3944] | 52 | void debug(); |
---|
| 53 | |
---|
[3655] | 54 | private: |
---|
[3923] | 55 | ParticleEngine(void); |
---|
[4394] | 56 | static ParticleEngine* singletonRef; //!< The reference to the engine. |
---|
[3925] | 57 | |
---|
[4394] | 58 | tList<ParticleSystem>* systemList; //!< A list of Systems handled by the ParticleEngine. |
---|
| 59 | tList<ParticleEmitter>* emitterList; //!< A list of Emitters handled by the ParticleEngine. |
---|
[3931] | 60 | |
---|
[4394] | 61 | tList<ParticleConnection>* connectionList; //!< A list of Connections between Systems and Emitters. |
---|
[3655] | 62 | }; |
---|
| 63 | |
---|
[3923] | 64 | #endif /* _PARTICLE_ENGINE_H */ |
---|