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