Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/particles/engine/particle_engine.h @ 10618

Last change on this file since 10618 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

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#include <list>
14
15#include "parser/tinyxml/tinyxml.h"
16
17// FORWARD DECLARATION
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  virtual 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 std::string& emitter, const std::string& 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  std::list<ParticleSystem> systemList;          //!< A list of Systems handled by the ParticleEngine.
67  std::list<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.