summaryrefslogtreecommitdiff
path: root/thirdparty/bullet/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/bullet/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h')
-rw-r--r--thirdparty/bullet/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h130
1 files changed, 66 insertions, 64 deletions
diff --git a/thirdparty/bullet/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h b/thirdparty/bullet/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h
index 9a781aaef1..ab73a899f1 100644
--- a/thirdparty/bullet/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h
+++ b/thirdparty/bullet/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h
@@ -19,7 +19,9 @@ subject to the following restrictions:
#include "BulletCollision/CollisionDispatch/btSimulationIslandManager.h"
class btTypedConstraint;
-
+class btConstraintSolver;
+struct btContactSolverInfo;
+class btIDebugDraw;
///
/// SimulationIslandManagerMt -- Multithread capable version of SimulationIslandManager
@@ -33,78 +35,78 @@ class btTypedConstraint;
class btSimulationIslandManagerMt : public btSimulationIslandManager
{
public:
- struct Island
- {
- // a simulation island consisting of bodies, manifolds and constraints,
- // to be passed into a constraint solver.
- btAlignedObjectArray<btCollisionObject*> bodyArray;
- btAlignedObjectArray<btPersistentManifold*> manifoldArray;
- btAlignedObjectArray<btTypedConstraint*> constraintArray;
- int id; // island id
- bool isSleeping;
+ struct Island
+ {
+ // a simulation island consisting of bodies, manifolds and constraints,
+ // to be passed into a constraint solver.
+ btAlignedObjectArray<btCollisionObject*> bodyArray;
+ btAlignedObjectArray<btPersistentManifold*> manifoldArray;
+ btAlignedObjectArray<btTypedConstraint*> constraintArray;
+ int id; // island id
+ bool isSleeping;
+
+ void append(const Island& other); // add bodies, manifolds, constraints to my own
+ };
+ struct SolverParams
+ {
+ btConstraintSolver* m_solverPool;
+ btConstraintSolver* m_solverMt;
+ btContactSolverInfo* m_solverInfo;
+ btIDebugDraw* m_debugDrawer;
+ btDispatcher* m_dispatcher;
+ };
+ static void solveIsland(btConstraintSolver* solver, Island& island, const SolverParams& solverParams);
- void append( const Island& other ); // add bodies, manifolds, constraints to my own
- };
- struct IslandCallback
- {
- virtual ~IslandCallback() {};
+ typedef void (*IslandDispatchFunc)(btAlignedObjectArray<Island*>* islands, const SolverParams& solverParams);
+ static void serialIslandDispatch(btAlignedObjectArray<Island*>* islandsPtr, const SolverParams& solverParams);
+ static void parallelIslandDispatch(btAlignedObjectArray<Island*>* islandsPtr, const SolverParams& solverParams);
- virtual void processIsland( btCollisionObject** bodies,
- int numBodies,
- btPersistentManifold** manifolds,
- int numManifolds,
- btTypedConstraint** constraints,
- int numConstraints,
- int islandId
- ) = 0;
- };
- typedef void( *IslandDispatchFunc ) ( btAlignedObjectArray<Island*>* islands, IslandCallback* callback );
- static void serialIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, IslandCallback* callback );
- static void parallelIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, IslandCallback* callback );
protected:
- btAlignedObjectArray<Island*> m_allocatedIslands; // owner of all Islands
- btAlignedObjectArray<Island*> m_activeIslands; // islands actively in use
- btAlignedObjectArray<Island*> m_freeIslands; // islands ready to be reused
- btAlignedObjectArray<Island*> m_lookupIslandFromId; // big lookup table to map islandId to Island pointer
- Island* m_batchIsland;
- int m_minimumSolverBatchSize;
- int m_batchIslandMinBodyCount;
- IslandDispatchFunc m_islandDispatch;
+ btAlignedObjectArray<Island*> m_allocatedIslands; // owner of all Islands
+ btAlignedObjectArray<Island*> m_activeIslands; // islands actively in use
+ btAlignedObjectArray<Island*> m_freeIslands; // islands ready to be reused
+ btAlignedObjectArray<Island*> m_lookupIslandFromId; // big lookup table to map islandId to Island pointer
+ Island* m_batchIsland;
+ int m_minimumSolverBatchSize;
+ int m_batchIslandMinBodyCount;
+ IslandDispatchFunc m_islandDispatch;
+
+ Island* getIsland(int id);
+ virtual Island* allocateIsland(int id, int numBodies);
+ virtual void initIslandPools();
+ virtual void addBodiesToIslands(btCollisionWorld* collisionWorld);
+ virtual void addManifoldsToIslands(btDispatcher* dispatcher);
+ virtual void addConstraintsToIslands(btAlignedObjectArray<btTypedConstraint*>& constraints);
+ virtual void mergeIslands();
- Island* getIsland( int id );
- virtual Island* allocateIsland( int id, int numBodies );
- virtual void initIslandPools();
- virtual void addBodiesToIslands( btCollisionWorld* collisionWorld );
- virtual void addManifoldsToIslands( btDispatcher* dispatcher );
- virtual void addConstraintsToIslands( btAlignedObjectArray<btTypedConstraint*>& constraints );
- virtual void mergeIslands();
-
public:
btSimulationIslandManagerMt();
virtual ~btSimulationIslandManagerMt();
- virtual void buildAndProcessIslands( btDispatcher* dispatcher, btCollisionWorld* collisionWorld, btAlignedObjectArray<btTypedConstraint*>& constraints, IslandCallback* callback );
+ virtual void buildAndProcessIslands(btDispatcher* dispatcher,
+ btCollisionWorld* collisionWorld,
+ btAlignedObjectArray<btTypedConstraint*>& constraints,
+ const SolverParams& solverParams);
- virtual void buildIslands(btDispatcher* dispatcher,btCollisionWorld* colWorld);
+ virtual void buildIslands(btDispatcher* dispatcher, btCollisionWorld* colWorld);
- int getMinimumSolverBatchSize() const
- {
- return m_minimumSolverBatchSize;
- }
- void setMinimumSolverBatchSize( int sz )
- {
- m_minimumSolverBatchSize = sz;
- }
- IslandDispatchFunc getIslandDispatchFunction() const
- {
- return m_islandDispatch;
- }
- // allow users to set their own dispatch function for multithreaded dispatch
- void setIslandDispatchFunction( IslandDispatchFunc func )
- {
- m_islandDispatch = func;
- }
+ int getMinimumSolverBatchSize() const
+ {
+ return m_minimumSolverBatchSize;
+ }
+ void setMinimumSolverBatchSize(int sz)
+ {
+ m_minimumSolverBatchSize = sz;
+ }
+ IslandDispatchFunc getIslandDispatchFunction() const
+ {
+ return m_islandDispatch;
+ }
+ // allow users to set their own dispatch function for multithreaded dispatch
+ void setIslandDispatchFunction(IslandDispatchFunc func)
+ {
+ m_islandDispatch = func;
+ }
};
-#endif //BT_SIMULATION_ISLAND_MANAGER_H
-
+#endif //BT_SIMULATION_ISLAND_MANAGER_H