[4677] | 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 | |
---|
[4677] | 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 | virtual ~ParticleEngine(void); |
---|
[4519] | 33 | /** \returns a Pointer to the only object of this Class */ |
---|
| 34 | inline static ParticleEngine* getInstance(void) { if (!singletonRef) singletonRef = new ParticleEngine(); return singletonRef; }; |
---|
[3655] | 35 | |
---|
[3925] | 36 | void tick(float dt); |
---|
[4349] | 37 | void draw(void) const; |
---|
[3925] | 38 | |
---|
[3931] | 39 | void addSystem(ParticleSystem* system); |
---|
| 40 | void addEmitter(ParticleEmitter* emitter); |
---|
[3932] | 41 | void addConnection(ParticleEmitter* emitter, ParticleSystem* system); |
---|
[3931] | 42 | |
---|
| 43 | bool removeSystem(ParticleSystem* system); |
---|
| 44 | bool removeEmitter(ParticleEmitter* emitter); |
---|
[3943] | 45 | bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system); |
---|
| 46 | bool breakConnection(ParticleConnection* connection); |
---|
[3931] | 47 | |
---|
[4338] | 48 | ParticleSystem* getSystemByName(const char* systemName) const; |
---|
| 49 | ParticleSystem* getSystemByNumber(unsigned int number) const; |
---|
| 50 | ParticleEmitter* getEmitterByName(const char* emitterName) const; |
---|
| 51 | ParticleEmitter* getEmitterByNumber(unsigned int number) const; |
---|
| 52 | |
---|
[3944] | 53 | void debug(); |
---|
| 54 | |
---|
[3655] | 55 | private: |
---|
[3923] | 56 | ParticleEngine(void); |
---|
[4394] | 57 | static ParticleEngine* singletonRef; //!< The reference to the engine. |
---|
[3925] | 58 | |
---|
[4394] | 59 | tList<ParticleSystem>* systemList; //!< A list of Systems handled by the ParticleEngine. |
---|
| 60 | tList<ParticleEmitter>* emitterList; //!< A list of Emitters handled by the ParticleEngine. |
---|
[3931] | 61 | |
---|
[4394] | 62 | tList<ParticleConnection>* connectionList; //!< A list of Connections between Systems and Emitters. |
---|
[3655] | 63 | }; |
---|
| 64 | |
---|
[3923] | 65 | #endif /* _PARTICLE_ENGINE_H */ |
---|