| [4558] | 1 | /*! | 
|---|
| [5039] | 2 |  * @file physics_engine.h | 
|---|
| [4836] | 3 |   *  Definition of the PhysicsEngine-singleton Class | 
|---|
| [4558] | 4 |  | 
|---|
| [3954] | 5 | */ | 
|---|
 | 6 |  | 
|---|
| [4121] | 7 | #ifndef _PHYSICS_ENGINE_H | 
|---|
 | 8 | #define _PHYSICS_ENGINE_H | 
|---|
| [3954] | 9 |  | 
|---|
 | 10 | #include "base_object.h" | 
|---|
| [4392] | 11 |  | 
|---|
| [4183] | 12 | #include "physics_connection.h" | 
|---|
| [4392] | 13 | #include "physics_interface.h" | 
|---|
| [4394] | 14 | #include "field.h" | 
|---|
| [5776] | 15 | #include <list> | 
|---|
| [3954] | 16 |  | 
|---|
| [4183] | 17 | // Forward Declaration | 
|---|
 | 18 | template<class T> class tList; | 
|---|
| [4728] | 19 | class TiXmlElement; | 
|---|
| [3954] | 20 |  | 
|---|
| [4558] | 21 | //! A class, that brings things into motion through Physics. | 
|---|
| [4121] | 22 | class PhysicsEngine : public BaseObject { | 
|---|
| [3954] | 23 |  | 
|---|
 | 24 |  public: | 
|---|
| [4746] | 25 |   virtual ~PhysicsEngine(); | 
|---|
| [4836] | 26 |   /** @returns a Pointer to the only object of this Class */ | 
|---|
| [4746] | 27 |   inline static PhysicsEngine* getInstance() { if (!singletonRef) singletonRef = new PhysicsEngine();  return singletonRef; }; | 
|---|
| [3954] | 28 |  | 
|---|
| [6512] | 29 |   virtual void loadParams(const TiXmlElement* root); | 
|---|
| [4733] | 30 |   void loadFields(const TiXmlElement* root); | 
|---|
 | 31 |   void loadConnections(const TiXmlElement* root); | 
|---|
| [4392] | 32 |  | 
|---|
| [4728] | 33 |   PhysicsInterface*      getPhysicsInterfaceByName(const char* physicsInterfaceName) const; | 
|---|
| [4392] | 34 |  | 
|---|
| [4728] | 35 |   void                   addField(Field* field); | 
|---|
 | 36 |   void                   removeField(Field* field); | 
|---|
 | 37 |   Field*                 getFieldByName(const char* FieldName) const; | 
|---|
| [3954] | 38 |  | 
|---|
| [4728] | 39 |   void                   addConnection(PhysicsConnection* connection); | 
|---|
 | 40 |   void                   removeConnection(PhysicsConnection* connection); | 
|---|
 | 41 |   PhysicsConnection*     getPhysicsConnectionByName(const char* physicsConnectionName) const; | 
|---|
| [4183] | 42 |  | 
|---|
| [4378] | 43 |  | 
|---|
| [4728] | 44 |   void                   tick(float dt); | 
|---|
 | 45 |  | 
|---|
| [4746] | 46 |   void                   debug() const; | 
|---|
| [4728] | 47 |  | 
|---|
| [3954] | 48 |  private: | 
|---|
| [4746] | 49 |   PhysicsEngine(); | 
|---|
| [3954] | 50 |  | 
|---|
| [4558] | 51 |  private: | 
|---|
 | 52 |   static PhysicsEngine*         singletonRef;         //!< the singleton reference of the PhysicsEngine | 
|---|
 | 53 |  | 
|---|
| [5776] | 54 |   std::list<Field*>             fields;               //!< a list of physicsl fields. | 
|---|
 | 55 |   std::list<PhysicsConnection*> connections;          //!< a list of physical connections. | 
|---|
| [5779] | 56 |   const std::list<BaseObject*>* interfaces;           //!< The list of physical interfaces. | 
|---|
| [3954] | 57 | }; | 
|---|
 | 58 |  | 
|---|
| [4183] | 59 |  | 
|---|
 | 60 |  | 
|---|
| [4121] | 61 | #endif /* _PHYSICS_ENGINE_H */ | 
|---|