Bullet Collision Detection & Physics Library
btDiscreteDynamicsWorldMt.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16
17#ifndef BT_DISCRETE_DYNAMICS_WORLD_MT_H
18#define BT_DISCRETE_DYNAMICS_WORLD_MT_H
19
23
25
36{
37public:
38 // create the solvers for me
39 explicit btConstraintSolverPoolMt( int numSolvers );
40
41 // pass in fully constructed solvers (destructor will delete them)
42 btConstraintSolverPoolMt( btConstraintSolver** solvers, int numSolvers );
43
45
47 virtual btScalar solveGroup( btCollisionObject** bodies,
48 int numBodies,
49 btPersistentManifold** manifolds,
50 int numManifolds,
51 btTypedConstraint** constraints,
52 int numConstraints,
53 const btContactSolverInfo& info,
54 btIDebugDraw* debugDrawer,
55 btDispatcher* dispatcher
57
58 virtual void reset() BT_OVERRIDE;
60
61private:
62 const static size_t kCacheLineSize = 128;
64 {
67 char _cachelinePadding[ kCacheLineSize - sizeof( btSpinMutex ) - sizeof( void* ) ]; // keep mutexes from sharing a cache line
68 };
71
73 void init( btConstraintSolver** solvers, int numSolvers );
74};
75
76
77
89{
90protected:
92
93 virtual void solveConstraints(btContactSolverInfo& solverInfo) BT_OVERRIDE;
94
95 virtual void predictUnconstraintMotion( btScalar timeStep ) BT_OVERRIDE;
96
98 {
102
103 void forLoop( int iBegin, int iEnd ) const BT_OVERRIDE
104 {
105 world->createPredictiveContactsInternal( &rigidBodies[ iBegin ], iEnd - iBegin, timeStep );
106 }
107 };
108 virtual void createPredictiveContacts( btScalar timeStep ) BT_OVERRIDE;
109
111 {
115
116 void forLoop( int iBegin, int iEnd ) const BT_OVERRIDE
117 {
118 world->integrateTransformsInternal( &rigidBodies[ iBegin ], iEnd - iBegin, timeStep );
119 }
120 };
121 virtual void integrateTransforms( btScalar timeStep ) BT_OVERRIDE;
122
123public:
125
127 btBroadphaseInterface* pairCache,
128 btConstraintSolverPoolMt* constraintSolver, // Note this should be a solver-pool for multi-threading
129 btCollisionConfiguration* collisionConfiguration
130 );
132};
133
134#endif //BT_DISCRETE_DYNAMICS_WORLD_H
btConstraintSolverType
btConstraintSolver provides solver interface
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:292
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:82
#define BT_OVERRIDE
Definition: btThreads.h:28
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs.
btCollisionConfiguration allows to configure Bullet collision detection stack allocator size,...
btCollisionObject can be used to manage collision detection objects.
btConstraintSolverPoolMt - masquerades as a constraint solver, but really it is a threadsafe pool of ...
ThreadSolver * getAndLockThreadSolver()
btConstraintSolverPoolMt
virtual void reset() BT_OVERRIDE
clear internal cached data and reset random seed
btConstraintSolverType m_solverType
void init(btConstraintSolver **solvers, int numSolvers)
virtual btConstraintSolverType getSolverType() const BT_OVERRIDE
virtual btScalar solveGroup(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifolds, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &info, btIDebugDraw *debugDrawer, btDispatcher *dispatcher) BT_OVERRIDE
solve a group of constraints
btAlignedObjectArray< ThreadSolver > m_solvers
btDiscreteDynamicsWorldMt – a version of DiscreteDynamicsWorld with some minor changes to support sol...
InplaceSolverIslandCallbackMt * m_solverIslandCallbackMt
btDiscreteDynamicsWorld provides discrete rigid body simulation those classes replace the obsolete Cc...
void integrateTransformsInternal(btRigidBody **bodies, int numBodies, btScalar timeStep)
void createPredictiveContactsInternal(btRigidBody **bodies, int numBodies, btScalar timeStep)
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition: btDispatcher.h:76
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
Definition: btIDebugDraw.h:30
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
The btRigidBody is the main class for rigid body objects.
Definition: btRigidBody.h:63
btSpinMutex – lightweight spin-mutex implemented with atomic ops, never puts a thread to sleep becaus...
Definition: btThreads.h:46
TypedConstraint is the baseclass for Bullet constraints and vehicles.
char _cachelinePadding[kCacheLineSize - sizeof(btSpinMutex) - sizeof(void *)]
void forLoop(int iBegin, int iEnd) const BT_OVERRIDE