Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/oggPlayer/src/lib/particles/particle_engine.h @ 4629

Last change on this file since 4629 was 4519, checked in by bensch, 20 years ago

orxonox/trunk: changed all getInstances into inline functions to save some (minor) time

File size: 2.2 KB
Line 
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
14template<class T> class tList;
15
16//! A ParticleConnection enables us to emitt from any emitter into any other particleSystem
17typedef 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*/
29class ParticleEngine : public BaseObject {
30
31 public:
32  virtual ~ParticleEngine(void);
33  /** \returns a Pointer to the only object of this Class */
34  inline static ParticleEngine* getInstance(void) { if (!singletonRef) singletonRef = new ParticleEngine();  return singletonRef; };
35
36  void tick(float dt);
37  void draw(void) const;
38
39  void addSystem(ParticleSystem* system);
40  void addEmitter(ParticleEmitter* emitter);
41  void addConnection(ParticleEmitter* emitter, ParticleSystem* system);
42
43  bool removeSystem(ParticleSystem* system);
44  bool removeEmitter(ParticleEmitter* emitter);
45  bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system);
46  bool breakConnection(ParticleConnection* connection);
47
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
53  void debug();
54
55 private:
56  ParticleEngine(void);
57  static ParticleEngine* singletonRef;        //!< The reference to the engine.
58
59  tList<ParticleSystem>* systemList;          //!< A list of Systems handled by the ParticleEngine.
60  tList<ParticleEmitter>* emitterList;        //!< A list of Emitters handled by the ParticleEngine.
61
62  tList<ParticleConnection>* connectionList;  //!< A list of Connections between Systems and Emitters.
63};
64
65#endif /* _PARTICLE_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.