Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: ini-parser in own subdir now (also moved tiXml-lib to lib/parser

File size: 2.3 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 "parser/tinyxml/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(ParticleConnection* connection);
53  bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system);
54  unsigned int breakConnections(ParticleEmitter* emitter);
55  unsigned int breakConnections(ParticleSystem* system);
56
57   ParticleSystem* getSystemByNumber(unsigned int number) const;
58   ParticleEmitter* getEmitterByNumber(unsigned int number) const;
59
60  void debug();
61
62 private:
63  ParticleEngine();
64  static ParticleEngine* singletonRef;        //!< The reference to the engine.
65
66  tList<ParticleSystem>* systemList;          //!< A list of Systems handled by the ParticleEngine.
67  tList<ParticleEmitter>* emitterList;        //!< A list of Emitters handled by the ParticleEngine.
68
69  tList<ParticleConnection>* connectionList;  //!< A list of Connections between Systems and Emitters.
70};
71
72#endif /* _PARTICLE_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.