UGDK  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
physics.h
Go to the documentation of this file.
1 #ifndef UGDK_ACTION_3D_PHYSICS_H_
2 #define UGDK_ACTION_3D_PHYSICS_H_
3 
4 #include <functional>
5 #include <forward_list>
6 #include <memory>
7 
8 namespace BtOgre {
9 class DebugDrawer;
10 }
11 
12 class btVector3;
13 class btBroadphaseInterface;
14 class btDefaultCollisionConfiguration;
15 class btCollisionDispatcher;
16 class btSequentialImpulseConstraintSolver;
17 class btDynamicsWorld;
18 class btDiscreteDynamicsWorld;
19 class btManifoldPoint;
20 
21 namespace ugdk {
22 namespace action {
23 namespace mode3d {
24 
25 class Scene3D;
26 class Element;
27 namespace component {
28 class PhysicsBody;
29 }
30 
31 class Physics {
32 public:
33  Physics(const btVector3& grav, Scene3D* scene);
34  ~Physics();
35 
36  void Update(double dt);
37 
40 
42  std::forward_list<std::weak_ptr<Element>> ContactQuery(short collision_groups, const btVector3& pos, double radius);
43 
45  bool debug_draw_enabled();
46  void set_debug_draw_enabled(bool enable);
47 
48 private:
49  btBroadphaseInterface* broadphase_;
50  btDefaultCollisionConfiguration* config_;
51  btCollisionDispatcher* dispatcher_;
52  btSequentialImpulseConstraintSolver* solver_;
53  btDiscreteDynamicsWorld* world_;
54 
55  BtOgre::DebugDrawer* debug_drawer_;
56 
57  static void tickCallback(btDynamicsWorld *world, float timeStep);
58 };
59 
60 } // namespace mode3d
61 } // namespace action
62 } // namespace ugdk
63 
64 #endif // UGDK_ACTION_3D_PHYSICS_H_
Definition: animation.h:11
void RemoveBody(component::PhysicsBody *obj)
void AddBody(component::PhysicsBody *obj)
Definition: physics.h:8
Physics(const btVector3 &grav, Scene3D *scene)
void set_debug_draw_enabled(bool enable)
std::forward_list< std::weak_ptr< Element > > ContactQuery(short collision_groups, const btVector3 &pos, double radius)
Definition: physics.h:31
A 3D game scene, or screen.
Definition: scene3d.h:32