Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/particles/particle_engine.h @ 5445

Last change on this file since 5445 was 5445, checked in by bensch, 19 years ago

orxonox/trunk: Connection-Removing in the Particle-Class

File size: 2.1 KB
Line 
1/*!
2 * @file particle_engine.h
3  *  Definition of the ParticleEngine
4*/
5
6#ifndef _PARTICLE_ENGINE_H
7#define _PARTICLE_ENGINE_H
8
9#include "base_object.h"
10
11#include "particle_system.h"
12#include "particle_emitter.h"
13
14#include "tinyxml.h"
15
16// FORWARD DECLARATION
17template<class T> class tList;
18
19//! A ParticleConnection enables us to emitt from any emitter into any other particleSystem
20typedef struct ParticleConnection
21{
22  ParticleEmitter*    emitter;     //!< The emitter to emit system from.
23  ParticleSystem*     system;      //!< The Particles emitted from emitter.
24};
25
26//! The physicsEngine handles and stores Systems and Emitters.
27/**
28   It is responsible for driving on the Particles (tick)
29   It draw particles (draw)
30   and it emitts particles into the system
31*/
32class ParticleEngine : public BaseObject {
33
34 public:
35  virtual ~ParticleEngine();
36  /** @returns a Pointer to the only object of this Class */
37  inline static ParticleEngine* getInstance() { if (!singletonRef) singletonRef = new ParticleEngine();  return singletonRef; };
38
39  void loadParams(const TiXmlElement* root);
40
41  void tick(float dt);
42  void draw() const;
43
44  void addSystem(ParticleSystem* system);
45  void addEmitter(ParticleEmitter* emitter);
46  void addConnection(ParticleEmitter* emitter, ParticleSystem* system);
47  void addConnection(const char* emitter, const char* system);
48
49
50  bool removeSystem(ParticleSystem* system);
51  bool removeEmitter(ParticleEmitter* emitter);
52  bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system);
53  bool breakConnection(ParticleConnection* connection);
54
55   ParticleSystem* getSystemByNumber(unsigned int number) const;
56   ParticleEmitter* getEmitterByNumber(unsigned int number) const;
57
58  void debug();
59
60 private:
61  ParticleEngine();
62  static ParticleEngine* singletonRef;        //!< The reference to the engine.
63
64  tList<ParticleSystem>* systemList;          //!< A list of Systems handled by the ParticleEngine.
65  tList<ParticleEmitter>* emitterList;        //!< A list of Emitters handled by the ParticleEngine.
66
67  tList<ParticleConnection>* connectionList;  //!< A list of Connections between Systems and Emitters.
68};
69
70#endif /* _PARTICLE_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.