Bullet Collision Detection & Physics Library
btDiscreteDynamicsWorldMt.cpp
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15 
16 
18 
19 //collision detection
26 #include "LinearMath/btQuickprof.h"
27 
28 //rigidbody & constraints
40 
41 
44 
45 
47 #include "LinearMath/btQuickprof.h"
49 
51 
52 
54 {
59 
61  btConstraintSolver* solver,
62  btStackAlloc* stackAlloc,
63  btDispatcher* dispatcher)
64  :m_solverInfo(NULL),
65  m_solver(solver),
66  m_debugDrawer(NULL),
67  m_dispatcher(dispatcher)
68  {
69 
70  }
71 
73  {
74  btAssert(0);
75  (void)other;
76  return *this;
77  }
78 
79  SIMD_FORCE_INLINE void setup ( btContactSolverInfo* solverInfo, btIDebugDraw* debugDrawer)
80  {
81  btAssert(solverInfo);
82  m_solverInfo = solverInfo;
83  m_debugDrawer = debugDrawer;
84  }
85 
86 
87  virtual void processIsland( btCollisionObject** bodies,
88  int numBodies,
89  btPersistentManifold** manifolds,
90  int numManifolds,
91  btTypedConstraint** constraints,
92  int numConstraints,
93  int islandId
94  )
95  {
96  m_solver->solveGroup( bodies,
97  numBodies,
98  manifolds,
99  numManifolds,
100  constraints,
101  numConstraints,
102  *m_solverInfo,
103  m_debugDrawer,
104  m_dispatcher
105  );
106  }
107 
108 };
109 
110 
111 
113 : btDiscreteDynamicsWorld(dispatcher,pairCache,constraintSolver,collisionConfiguration)
114 {
116  {
119  }
120  {
121  void* mem = btAlignedAlloc(sizeof(InplaceSolverIslandCallbackMt),16);
123  }
124  {
125  void* mem = btAlignedAlloc(sizeof(btSimulationIslandManagerMt),16);
127  m_islandManager = im;
129  }
130 }
131 
132 
134 {
136  {
137  m_solverIslandCallbackMt->~InplaceSolverIslandCallbackMt();
139  }
141  {
144  }
145 }
146 
147 
149 {
150  BT_PROFILE("solveConstraints");
151 
154 
158 
160 }
161 
162 
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
btDiscreteDynamicsWorldMt(btDispatcher *dispatcher, btBroadphaseInterface *pairCache, btConstraintSolver *constraintSolver, btCollisionConfiguration *collisionConfiguration)
btSimulationIslandManager * m_islandManager
virtual void buildAndProcessIslands(btDispatcher *dispatcher, btCollisionWorld *collisionWorld, btAlignedObjectArray< btTypedConstraint *> &constraints, IslandCallback *callback)
btDiscreteDynamicsWorld provides discrete rigid body simulation those classes replace the obsolete Cc...
#define btAssert(x)
Definition: btScalar.h:114
btCollisionConfiguration allows to configure Bullet collision detection stack allocator size...
virtual void solveConstraints(btContactSolverInfo &solverInfo)
virtual btScalar solveGroup(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifold, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &info, class btIDebugDraw *debugDrawer, btDispatcher *dispatcher)=0
solve a group of constraints
#define SIMD_FORCE_INLINE
Definition: btScalar.h:64
InplaceSolverIslandCallbackMt(btConstraintSolver *solver, btStackAlloc *stackAlloc, btDispatcher *dispatcher)
The StackAlloc class provides some fast stack-based memory allocator (LIFO last-in first-out) ...
Definition: btStackAlloc.h:34
btContactSolverInfo m_solverInfo
int getNumCollisionObjects() const
btCollisionWorld * getCollisionWorld()
btIDebugDraw * m_debugDrawer
virtual btIDebugDraw * getDebugDrawer()
#define btAlignedFree(ptr)
btCollisionObject can be used to manage collision detection objects.
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
Definition: btIDebugDraw.h:29
void setup(btContactSolverInfo *solverInfo, btIDebugDraw *debugDrawer)
The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs...
btDispatcher * getDispatcher()
#define BT_PROFILE(name)
Definition: btQuickprof.h:213
virtual void allSolved(const btContactSolverInfo &, class btIDebugDraw *)
virtual void prepareSolve(int, int)
TypedConstraint is the baseclass for Bullet constraints and vehicles.
#define btAlignedAlloc(size, alignment)
btConstraintSolver * m_constraintSolver
virtual void processIsland(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifolds, int numManifolds, btTypedConstraint **constraints, int numConstraints, int islandId)
InplaceSolverIslandCallbackMt & operator=(InplaceSolverIslandCallbackMt &other)
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition: btDispatcher.h:75
InplaceSolverIslandCallbackMt * m_solverIslandCallbackMt
SimulationIslandManagerMt – Multithread capable version of SimulationIslandManager Splits the world...
btAlignedObjectArray< btTypedConstraint * > m_constraints