Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: loadParams is now virtual.
ALL THE CLASSES HAVE TO CALL

SuperClass::loadParams(root);

isntead of:
static_cast<SuperClass*>(this)→loadParams(root);

which was quite stupid anyways

File size: 2.3 KB
RevLine 
[4677]1/*!
[5039]2 * @file particle_engine.h
[4836]3  *  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"
[4726]10
[4176]11#include "particle_system.h"
12#include "particle_emitter.h"
[3655]13
[5944]14#include "parser/tinyxml/tinyxml.h"
[4726]15
[5405]16// FORWARD DECLARATION
[3925]17template<class T> class tList;
[3655]18
[4478]19//! A ParticleConnection enables us to emitt from any emitter into any other particleSystem
20typedef struct ParticleConnection
[3931]21{
[4478]22  ParticleEmitter*    emitter;     //!< The emitter to emit system from.
23  ParticleSystem*     system;      //!< The Particles emitted from emitter.
[3931]24};
[3925]25
[4394]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*/
[3923]32class ParticleEngine : public BaseObject {
[3655]33
34 public:
[4746]35  virtual ~ParticleEngine();
[4836]36  /** @returns a Pointer to the only object of this Class */
[4746]37  inline static ParticleEngine* getInstance() { if (!singletonRef) singletonRef = new ParticleEngine();  return singletonRef; };
[3655]38
[6512]39  virtual void loadParams(const TiXmlElement* root);
[4726]40
[3925]41  void tick(float dt);
[4746]42  void draw() const;
[3925]43
[3931]44  void addSystem(ParticleSystem* system);
45  void addEmitter(ParticleEmitter* emitter);
[3932]46  void addConnection(ParticleEmitter* emitter, ParticleSystem* system);
[4726]47  void addConnection(const char* emitter, const char* system);
[3931]48
[4726]49
[3931]50  bool removeSystem(ParticleSystem* system);
51  bool removeEmitter(ParticleEmitter* emitter);
[5447]52  bool breakConnection(ParticleConnection* connection);
[3943]53  bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system);
[5447]54  unsigned int breakConnections(ParticleEmitter* emitter);
55  unsigned int breakConnections(ParticleSystem* system);
[3931]56
[5445]57   ParticleSystem* getSystemByNumber(unsigned int number) const;
58   ParticleEmitter* getEmitterByNumber(unsigned int number) const;
[4338]59
[3944]60  void debug();
61
[3655]62 private:
[4746]63  ParticleEngine();
[4394]64  static ParticleEngine* singletonRef;        //!< The reference to the engine.
[3925]65
[4394]66  tList<ParticleSystem>* systemList;          //!< A list of Systems handled by the ParticleEngine.
67  tList<ParticleEmitter>* emitterList;        //!< A list of Emitters handled by the ParticleEngine.
[3931]68
[4394]69  tList<ParticleConnection>* connectionList;  //!< A list of Connections between Systems and Emitters.
[3655]70};
71
[3923]72#endif /* _PARTICLE_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.