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