Image Component Library (ICL)
PhysicsWorld.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2014 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLPhysics/src/ICLPhysics/PhysicsWorld.h **
10 ** Module : ICLPhysics **
11 ** Author : Christof Elbrechter, Matthias Esau **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 #pragma once
31 
32 #include <ICLUtils/Uncopyable.h>
33 #include <ICLUtils/Lockable.h>
34 #include <ICLMath/DynMatrix.h>
35 #include <ICLGeom/Geom.h>
36 #include <ICLPhysics/PhysicsDefs.h>
37 
38 #include <vector>
39 
40 
42 class btSoftBodyWorldInfo;
45 namespace icl{
46  namespace geom{
47  class ViewRay;
48  }
49  namespace physics{
50 
51  class PhysicsObject;
52  class RigidObject;
53  class Constraint;
54 
57 
58  public:
59 
65  Default = SequentialImpulseConstraintSolver
66  };
67 
68  private:
69 
70  friend class PhysicsObject;
72  struct Data;
73 
75  Data *data;
76 
77  void setSolver(BulletSolverType type);
78 
79  protected:
80 
82  void removeContactPoints(PhysicsObject *obj);
83 
84  public:
85 
87  PhysicsWorld(BulletSolverType solver_type = Default);
88 
90  ~PhysicsWorld();
91 
93  void addObject(PhysicsObject *obj);
94 
96  void removeObject(PhysicsObject *obj);
97 
99  void setGravity(const geom::Vec &gravity);
100 
102 
105  void setGravityEnabled(bool on, const geom::Vec *useThisGravityIfOn=0);
106 
108  void splitImpulseEnabled(bool enable);
109 
111 
113  void step(float dtSeconds=-1, int maxSubSteps=10, float fixedTimeStep=1.f/120.f);
114 
116  double getLastTimeDelta();
117 
119  bool collideWithWorld(RigidObject* obj, bool ignoreJoints = true);
120 
122  void setGroupCollision(int group0, int group1, bool collides);
123 
125  bool getGroupCollision(int group0, int group1);
126 
128  bool rayCast(const geom::ViewRay& ray, float rayLength, PhysicsObject*& obj, geom::Vec &normal, geom::Vec &hitPoint);
129 
131  void addConstraint(Constraint* constraint, bool disableCollisionWithLinkedBodies = false, bool passOwnerShip=false);
132 
134  void removeConstraint(Constraint* constraint);
135 
137  const btSoftBodyWorldInfo *getWorldInfo() const;
138 
140  btSoftBodyWorldInfo *getWorldInfo();
141  };
142  }
143 }
undocument this line if you encounter any issues!
Definition: Any.h:37
Class interface for un-copyable classes.
Definition: Uncopyable.h:64
Definition: PhysicsWorld.h:62
A physical world that handles physical objects.
Definition: PhysicsWorld.h:56
Definition: PhysicsWorld.h:64
#define ICLPhysics_API
Definition: CompatMacros.h:181
This class combines a movable but rigid physics object and it's graphical representation in ICL.
Definition: RigidObject.h:46
This is a view-ray's line equation in parameter form.
Definition: ViewRay.h:49
Base Class for constraints.
Definition: Constraint.h:41
Definition: PhysicsWorld.h:63
Interface for objects, that can be locked using an internal mutex.
Definition: Lockable.h:41
Data * data
internal data pointer
Definition: PhysicsWorld.h:72
This class combines an physical object and it's graphical representation in ICL.
Definition: PhysicsObject.h:44
BulletSolverType
Definition: PhysicsWorld.h:60