Don't pass along unused btStackAlloc everywhere. The API change might user code (derived classes with the old virtual method are not called anymore)

This commit is contained in:
erwin.coumans@gmail.com 2013-05-08 22:45:35 +00:00
parent 329b9a1e3c
commit 542c53fb30
29 changed files with 65 additions and 94 deletions

View File

@ -326,6 +326,25 @@ void DemoApplication::keyboardCallback(unsigned char key, int x, int y)
switch (key) switch (key)
{ {
case 8:
{
int numObj = getDynamicsWorld()->getNumCollisionObjects();
if (numObj)
{
btCollisionObject* obj = getDynamicsWorld()->getCollisionObjectArray()[numObj-1];
getDynamicsWorld()->removeCollisionObject(obj);
btRigidBody* body = btRigidBody::upcast(obj);
if (body && body->getMotionState())
{
delete body->getMotionState();
}
delete obj;
}
break;
}
case 'q' : case 'q' :
#ifdef BT_USE_FREEGLUT #ifdef BT_USE_FREEGLUT
//return from glutMainLoop(), detect memory leaks etc. //return from glutMainLoop(), detect memory leaks etc.
@ -1182,8 +1201,8 @@ void DemoApplication::renderscene(int pass)
} }
} }
btVector3 aabbMin,aabbMax; btVector3 aabbMin(0,0,0),aabbMax(0,0,0);
m_dynamicsWorld->getBroadphase()->getBroadphaseAabb(aabbMin,aabbMax); //m_dynamicsWorld->getBroadphase()->getBroadphaseAabb(aabbMin,aabbMax);
aabbMin-=btVector3(BT_LARGE_FLOAT,BT_LARGE_FLOAT,BT_LARGE_FLOAT); aabbMin-=btVector3(BT_LARGE_FLOAT,BT_LARGE_FLOAT,BT_LARGE_FLOAT);
aabbMax+=btVector3(BT_LARGE_FLOAT,BT_LARGE_FLOAT,BT_LARGE_FLOAT); aabbMax+=btVector3(BT_LARGE_FLOAT,BT_LARGE_FLOAT,BT_LARGE_FLOAT);

View File

@ -149,6 +149,11 @@ public:
{ {
m_azi = azi; m_azi = azi;
} }
void setEle(float ele)
{
m_ele = ele;
}
void setCameraUp(const btVector3& camUp) void setCameraUp(const btVector3& camUp)
{ {

View File

@ -25,7 +25,6 @@ class btOverlappingPairCache;
struct btCollisionObjectWrapper; struct btCollisionObjectWrapper;
class btPersistentManifold; class btPersistentManifold;
class btStackAlloc;
class btPoolAllocator; class btPoolAllocator;
struct btDispatcherInfo struct btDispatcherInfo
@ -47,8 +46,7 @@ struct btDispatcherInfo
m_useEpa(true), m_useEpa(true),
m_allowedCcdPenetration(btScalar(0.04)), m_allowedCcdPenetration(btScalar(0.04)),
m_useConvexConservativeDistanceUtil(false), m_useConvexConservativeDistanceUtil(false),
m_convexConservativeDistanceThreshold(0.0f), m_convexConservativeDistanceThreshold(0.0f)
m_stackAllocator(0)
{ {
} }
@ -64,7 +62,6 @@ struct btDispatcherInfo
btScalar m_allowedCcdPenetration; btScalar m_allowedCcdPenetration;
bool m_useConvexConservativeDistanceUtil; bool m_useConvexConservativeDistanceUtil;
btScalar m_convexConservativeDistanceThreshold; btScalar m_convexConservativeDistanceThreshold;
btStackAlloc* m_stackAllocator;
}; };
///The btDispatcher interface class can be used in combination with broadphase to dispatch calculations for overlapping pairs. ///The btDispatcher interface class can be used in combination with broadphase to dispatch calculations for overlapping pairs.

View File

@ -18,7 +18,6 @@ subject to the following restrictions:
struct btCollisionAlgorithmCreateFunc; struct btCollisionAlgorithmCreateFunc;
class btStackAlloc;
class btPoolAllocator; class btPoolAllocator;
///btCollisionConfiguration allows to configure Bullet collision detection ///btCollisionConfiguration allows to configure Bullet collision detection
@ -38,7 +37,6 @@ public:
virtual btPoolAllocator* getCollisionAlgorithmPool() = 0; virtual btPoolAllocator* getCollisionAlgorithmPool() = 0;
virtual btStackAlloc* getStackAllocator() = 0;
virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1) =0; virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1) =0;

View File

@ -31,7 +31,6 @@ subject to the following restrictions:
#include "BulletCollision/BroadphaseCollision/btDbvt.h" #include "BulletCollision/BroadphaseCollision/btDbvt.h"
#include "LinearMath/btAabbUtil2.h" #include "LinearMath/btAabbUtil2.h"
#include "LinearMath/btQuickprof.h" #include "LinearMath/btQuickprof.h"
#include "LinearMath/btStackAlloc.h"
#include "LinearMath/btSerializer.h" #include "LinearMath/btSerializer.h"
#include "BulletCollision/CollisionShapes/btConvexPolyhedron.h" #include "BulletCollision/CollisionShapes/btConvexPolyhedron.h"
#include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h" #include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h"
@ -73,8 +72,6 @@ m_broadphasePairCache(pairCache),
m_debugDrawer(0), m_debugDrawer(0),
m_forceUpdateAllAabbs(true) m_forceUpdateAllAabbs(true)
{ {
m_stackAlloc = collisionConfiguration->getStackAllocator();
m_dispatchInfo.m_stackAllocator = m_stackAlloc;
} }

View File

@ -65,7 +65,6 @@ subject to the following restrictions:
#ifndef BT_COLLISION_WORLD_H #ifndef BT_COLLISION_WORLD_H
#define BT_COLLISION_WORLD_H #define BT_COLLISION_WORLD_H
class btStackAlloc;
class btCollisionShape; class btCollisionShape;
class btConvexShape; class btConvexShape;
class btBroadphaseInterface; class btBroadphaseInterface;
@ -91,8 +90,6 @@ protected:
btDispatcherInfo m_dispatchInfo; btDispatcherInfo m_dispatchInfo;
btStackAlloc* m_stackAlloc;
btBroadphaseInterface* m_broadphasePairCache; btBroadphaseInterface* m_broadphasePairCache;
btIDebugDraw* m_debugDrawer; btIDebugDraw* m_debugDrawer;

View File

@ -132,7 +132,6 @@ void btConvex2dConvex2dAlgorithm ::processCollision (const btCollisionObjectWrap
input.m_maximumDistanceSquared*= input.m_maximumDistanceSquared; input.m_maximumDistanceSquared*= input.m_maximumDistanceSquared;
} }
input.m_stackAlloc = dispatchInfo.m_stackAllocator;
input.m_transformA = body0Wrap->getWorldTransform(); input.m_transformA = body0Wrap->getWorldTransform();
input.m_transformB = body1Wrap->getWorldTransform(); input.m_transformB = body1Wrap->getWorldTransform();

View File

@ -373,7 +373,6 @@ void btConvexConvexAlgorithm ::processCollision (const btCollisionObjectWrapper*
input.m_maximumDistanceSquared*= input.m_maximumDistanceSquared; input.m_maximumDistanceSquared*= input.m_maximumDistanceSquared;
} }
input.m_stackAlloc = dispatchInfo.m_stackAllocator;
input.m_transformA = body0Wrap->getWorldTransform(); input.m_transformA = body0Wrap->getWorldTransform();
input.m_transformB = body1Wrap->getWorldTransform(); input.m_transformB = body1Wrap->getWorldTransform();

View File

@ -32,7 +32,6 @@ subject to the following restrictions:
#include "LinearMath/btStackAlloc.h"
#include "LinearMath/btPoolAllocator.h" #include "LinearMath/btPoolAllocator.h"
@ -106,16 +105,6 @@ btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(const btDefault
collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize2); collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize2);
collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize3); collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize3);
if (constructionInfo.m_stackAlloc)
{
m_ownsStackAllocator = false;
this->m_stackAlloc = constructionInfo.m_stackAlloc;
} else
{
m_ownsStackAllocator = true;
void* mem = btAlignedAlloc(sizeof(btStackAlloc),16);
m_stackAlloc = new(mem)btStackAlloc(constructionInfo.m_defaultStackAllocatorSize);
}
if (constructionInfo.m_persistentManifoldPool) if (constructionInfo.m_persistentManifoldPool)
{ {
@ -144,12 +133,6 @@ btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(const btDefault
btDefaultCollisionConfiguration::~btDefaultCollisionConfiguration() btDefaultCollisionConfiguration::~btDefaultCollisionConfiguration()
{ {
if (m_ownsStackAllocator)
{
m_stackAlloc->destroy();
m_stackAlloc->~btStackAlloc();
btAlignedFree(m_stackAlloc);
}
if (m_ownsCollisionAlgorithmPool) if (m_ownsCollisionAlgorithmPool)
{ {
m_collisionAlgorithmPool->~btPoolAllocator(); m_collisionAlgorithmPool->~btPoolAllocator();

View File

@ -22,23 +22,19 @@ class btConvexPenetrationDepthSolver;
struct btDefaultCollisionConstructionInfo struct btDefaultCollisionConstructionInfo
{ {
btStackAlloc* m_stackAlloc;
btPoolAllocator* m_persistentManifoldPool; btPoolAllocator* m_persistentManifoldPool;
btPoolAllocator* m_collisionAlgorithmPool; btPoolAllocator* m_collisionAlgorithmPool;
int m_defaultMaxPersistentManifoldPoolSize; int m_defaultMaxPersistentManifoldPoolSize;
int m_defaultMaxCollisionAlgorithmPoolSize; int m_defaultMaxCollisionAlgorithmPoolSize;
int m_customCollisionAlgorithmMaxElementSize; int m_customCollisionAlgorithmMaxElementSize;
int m_defaultStackAllocatorSize;
int m_useEpaPenetrationAlgorithm; int m_useEpaPenetrationAlgorithm;
btDefaultCollisionConstructionInfo() btDefaultCollisionConstructionInfo()
:m_stackAlloc(0), :m_persistentManifoldPool(0),
m_persistentManifoldPool(0),
m_collisionAlgorithmPool(0), m_collisionAlgorithmPool(0),
m_defaultMaxPersistentManifoldPoolSize(4096), m_defaultMaxPersistentManifoldPoolSize(4096),
m_defaultMaxCollisionAlgorithmPoolSize(4096), m_defaultMaxCollisionAlgorithmPoolSize(4096),
m_customCollisionAlgorithmMaxElementSize(0), m_customCollisionAlgorithmMaxElementSize(0),
m_defaultStackAllocatorSize(0),
m_useEpaPenetrationAlgorithm(true) m_useEpaPenetrationAlgorithm(true)
{ {
} }
@ -56,8 +52,6 @@ protected:
int m_persistentManifoldPoolSize; int m_persistentManifoldPoolSize;
btStackAlloc* m_stackAlloc;
bool m_ownsStackAllocator;
btPoolAllocator* m_persistentManifoldPool; btPoolAllocator* m_persistentManifoldPool;
bool m_ownsPersistentManifoldPool; bool m_ownsPersistentManifoldPool;
@ -105,10 +99,6 @@ public:
return m_collisionAlgorithmPool; return m_collisionAlgorithmPool;
} }
virtual btStackAlloc* getStackAllocator()
{
return m_stackAlloc;
}
virtual btVoronoiSimplexSolver* getSimplexSolver() virtual btVoronoiSimplexSolver* getSimplexSolver()
{ {

View File

@ -17,7 +17,6 @@ subject to the following restrictions:
#ifndef BT_CONVEX_PENETRATION_DEPTH_H #ifndef BT_CONVEX_PENETRATION_DEPTH_H
#define BT_CONVEX_PENETRATION_DEPTH_H #define BT_CONVEX_PENETRATION_DEPTH_H
class btStackAlloc;
class btVector3; class btVector3;
#include "btSimplexSolverInterface.h" #include "btSimplexSolverInterface.h"
class btConvexShape; class btConvexShape;
@ -33,8 +32,7 @@ public:
const btConvexShape* convexA,const btConvexShape* convexB, const btConvexShape* convexA,const btConvexShape* convexB,
const btTransform& transA,const btTransform& transB, const btTransform& transA,const btTransform& transB,
btVector3& v, btVector3& pa, btVector3& pb, btVector3& v, btVector3& pa, btVector3& pb,
class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc class btIDebugDraw* debugDraw) = 0;
) = 0;
}; };

View File

@ -19,7 +19,6 @@ subject to the following restrictions:
#include "LinearMath/btTransform.h" #include "LinearMath/btTransform.h"
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
class btStackAlloc;
/// This interface is made to be used by an iterative approach to do TimeOfImpact calculations /// This interface is made to be used by an iterative approach to do TimeOfImpact calculations
/// This interface allows to query for closest points and penetration depth between two (convex) objects /// This interface allows to query for closest points and penetration depth between two (convex) objects
@ -43,15 +42,13 @@ struct btDiscreteCollisionDetectorInterface
struct ClosestPointInput struct ClosestPointInput
{ {
ClosestPointInput() ClosestPointInput()
:m_maximumDistanceSquared(btScalar(BT_LARGE_FLOAT)), :m_maximumDistanceSquared(btScalar(BT_LARGE_FLOAT))
m_stackAlloc(0)
{ {
} }
btTransform m_transformA; btTransform m_transformA;
btTransform m_transformB; btTransform m_transformB;
btScalar m_maximumDistanceSquared; btScalar m_maximumDistanceSquared;
btStackAlloc* m_stackAlloc;
}; };
virtual ~btDiscreteCollisionDetectorInterface() {}; virtual ~btDiscreteCollisionDetectorInterface() {};

View File

@ -25,7 +25,7 @@ bool btGjkEpaPenetrationDepthSolver::calcPenDepth( btSimplexSolverInterface& sim
const btConvexShape* pConvexA, const btConvexShape* pConvexB, const btConvexShape* pConvexA, const btConvexShape* pConvexB,
const btTransform& transformA, const btTransform& transformB, const btTransform& transformA, const btTransform& transformB,
btVector3& v, btVector3& wWitnessOnA, btVector3& wWitnessOnB, btVector3& v, btVector3& wWitnessOnA, btVector3& wWitnessOnB,
class btIDebugDraw* debugDraw, btStackAlloc* stackAlloc ) class btIDebugDraw* debugDraw)
{ {
(void)debugDraw; (void)debugDraw;

View File

@ -33,7 +33,7 @@ class btGjkEpaPenetrationDepthSolver : public btConvexPenetrationDepthSolver
const btConvexShape* pConvexA, const btConvexShape* pConvexB, const btConvexShape* pConvexA, const btConvexShape* pConvexB,
const btTransform& transformA, const btTransform& transformB, const btTransform& transformA, const btTransform& transformB,
btVector3& v, btVector3& wWitnessOnA, btVector3& wWitnessOnB, btVector3& v, btVector3& wWitnessOnA, btVector3& wWitnessOnB,
class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc ); class btIDebugDraw* debugDraw);
private : private :

View File

@ -355,7 +355,7 @@ void btGjkPairDetector::getClosestPointsNonVirtual(const ClosestPointInput& inpu
m_minkowskiA,m_minkowskiB, m_minkowskiA,m_minkowskiB,
localTransA,localTransB, localTransA,localTransB,
m_cachedSeparatingAxis, tmpPointOnA, tmpPointOnB, m_cachedSeparatingAxis, tmpPointOnA, tmpPointOnB,
debugDraw,input.m_stackAlloc debugDraw
); );

View File

@ -26,11 +26,10 @@ bool btMinkowskiPenetrationDepthSolver::calcPenDepth(btSimplexSolverInterface& s
const btConvexShape* convexA,const btConvexShape* convexB, const btConvexShape* convexA,const btConvexShape* convexB,
const btTransform& transA,const btTransform& transB, const btTransform& transA,const btTransform& transB,
btVector3& v, btVector3& pa, btVector3& pb, btVector3& v, btVector3& pa, btVector3& pb,
class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc class btIDebugDraw* debugDraw
) )
{ {
(void)stackAlloc;
(void)v; (void)v;
bool check2d= convexA->isConvex2d() && convexB->isConvex2d(); bool check2d= convexA->isConvex2d() && convexB->isConvex2d();

View File

@ -32,7 +32,7 @@ public:
const btConvexShape* convexA,const btConvexShape* convexB, const btConvexShape* convexA,const btConvexShape* convexB,
const btTransform& transA,const btTransform& transB, const btTransform& transA,const btTransform& transB,
btVector3& v, btVector3& pa, btVector3& pb, btVector3& v, btVector3& pa, btVector3& pb,
class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc class btIDebugDraw* debugDraw
); );
}; };

View File

@ -38,9 +38,9 @@ public:
virtual void prepareSolve (int /* numBodies */, int /* numManifolds */) {;} virtual void prepareSolve (int /* numBodies */, int /* numManifolds */) {;}
///solve a group of constraints ///solve a group of constraints
virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** constraints,int numConstraints, const btContactSolverInfo& info,class btIDebugDraw* debugDrawer, btStackAlloc* stackAlloc,btDispatcher* dispatcher) = 0; virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** constraints,int numConstraints, const btContactSolverInfo& info,class btIDebugDraw* debugDrawer,btDispatcher* dispatcher) = 0;
virtual void allSolved (const btContactSolverInfo& /* info */,class btIDebugDraw* /* debugDrawer */, btStackAlloc* /* stackAlloc */) {;} virtual void allSolved (const btContactSolverInfo& /* info */,class btIDebugDraw* /* debugDrawer */) {;}
///clear internal cached data and reset random seed ///clear internal cached data and reset random seed
virtual void reset() = 0; virtual void reset() = 0;

View File

@ -909,10 +909,9 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m
} }
} }
btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCollisionObject** bodies, int numBodies, btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc) btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCollisionObject** bodies, int numBodies, btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer)
{ {
BT_PROFILE("solveGroupCacheFriendlySetup"); BT_PROFILE("solveGroupCacheFriendlySetup");
(void)stackAlloc;
(void)debugDrawer; (void)debugDrawer;
m_maxOverrideNumSolverIterations = 0; m_maxOverrideNumSolverIterations = 0;
@ -1256,7 +1255,7 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol
} }
btScalar btSequentialImpulseConstraintSolver::solveSingleIteration(int iteration, btCollisionObject** /*bodies */,int /*numBodies*/,btPersistentManifold** /*manifoldPtr*/, int /*numManifolds*/,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* /*debugDrawer*/,btStackAlloc* /*stackAlloc*/) btScalar btSequentialImpulseConstraintSolver::solveSingleIteration(int iteration, btCollisionObject** /*bodies */,int /*numBodies*/,btPersistentManifold** /*manifoldPtr*/, int /*numManifolds*/,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* /*debugDrawer*/)
{ {
int numNonContactPool = m_tmpSolverNonContactConstraintPool.size(); int numNonContactPool = m_tmpSolverNonContactConstraintPool.size();
@ -1492,7 +1491,7 @@ btScalar btSequentialImpulseConstraintSolver::solveSingleIteration(int iteration
} }
void btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySplitImpulseIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc) void btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySplitImpulseIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer)
{ {
int iteration; int iteration;
if (infoGlobal.m_splitImpulse) if (infoGlobal.m_splitImpulse)
@ -1532,20 +1531,20 @@ void btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySplitImpulseIte
} }
} }
btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlyIterations(btCollisionObject** bodies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc) btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlyIterations(btCollisionObject** bodies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer)
{ {
BT_PROFILE("solveGroupCacheFriendlyIterations"); BT_PROFILE("solveGroupCacheFriendlyIterations");
{ {
///this is a special step to resolve penetrations (just for contacts) ///this is a special step to resolve penetrations (just for contacts)
solveGroupCacheFriendlySplitImpulseIterations(bodies ,numBodies,manifoldPtr, numManifolds,constraints,numConstraints,infoGlobal,debugDrawer,stackAlloc); solveGroupCacheFriendlySplitImpulseIterations(bodies ,numBodies,manifoldPtr, numManifolds,constraints,numConstraints,infoGlobal,debugDrawer);
int maxIterations = m_maxOverrideNumSolverIterations > infoGlobal.m_numIterations? m_maxOverrideNumSolverIterations : infoGlobal.m_numIterations; int maxIterations = m_maxOverrideNumSolverIterations > infoGlobal.m_numIterations? m_maxOverrideNumSolverIterations : infoGlobal.m_numIterations;
for ( int iteration = 0 ; iteration< maxIterations ; iteration++) for ( int iteration = 0 ; iteration< maxIterations ; iteration++)
//for ( int iteration = maxIterations-1 ; iteration >= 0;iteration--) //for ( int iteration = maxIterations-1 ; iteration >= 0;iteration--)
{ {
solveSingleIteration(iteration, bodies ,numBodies,manifoldPtr, numManifolds,constraints,numConstraints,infoGlobal,debugDrawer,stackAlloc); solveSingleIteration(iteration, bodies ,numBodies,manifoldPtr, numManifolds,constraints,numConstraints,infoGlobal,debugDrawer);
} }
} }
@ -1632,15 +1631,15 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlyFinish(btCo
/// btSequentialImpulseConstraintSolver Sequentially applies impulses /// btSequentialImpulseConstraintSolver Sequentially applies impulses
btScalar btSequentialImpulseConstraintSolver::solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc,btDispatcher* /*dispatcher*/) btScalar btSequentialImpulseConstraintSolver::solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btDispatcher* /*dispatcher*/)
{ {
BT_PROFILE("solveGroup"); BT_PROFILE("solveGroup");
//you need to provide at least some bodies //you need to provide at least some bodies
solveGroupCacheFriendlySetup( bodies, numBodies, manifoldPtr, numManifolds,constraints, numConstraints,infoGlobal,debugDrawer, stackAlloc); solveGroupCacheFriendlySetup( bodies, numBodies, manifoldPtr, numManifolds,constraints, numConstraints,infoGlobal,debugDrawer);
solveGroupCacheFriendlyIterations(bodies, numBodies, manifoldPtr, numManifolds,constraints, numConstraints,infoGlobal,debugDrawer, stackAlloc); solveGroupCacheFriendlyIterations(bodies, numBodies, manifoldPtr, numManifolds,constraints, numConstraints,infoGlobal,debugDrawer);
solveGroupCacheFriendlyFinish(bodies, numBodies, infoGlobal); solveGroupCacheFriendlyFinish(bodies, numBodies, infoGlobal);

View File

@ -18,7 +18,6 @@ subject to the following restrictions:
class btIDebugDraw; class btIDebugDraw;
class btPersistentManifold; class btPersistentManifold;
class btStackAlloc;
class btDispatcher; class btDispatcher;
class btCollisionObject; class btCollisionObject;
#include "BulletDynamics/ConstraintSolver/btTypedConstraint.h" #include "BulletDynamics/ConstraintSolver/btTypedConstraint.h"
@ -97,12 +96,12 @@ protected:
protected: protected:
virtual void solveGroupCacheFriendlySplitImpulseIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); virtual void solveGroupCacheFriendlySplitImpulseIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer);
virtual btScalar solveGroupCacheFriendlyFinish(btCollisionObject** bodies,int numBodies,const btContactSolverInfo& infoGlobal); virtual btScalar solveGroupCacheFriendlyFinish(btCollisionObject** bodies,int numBodies,const btContactSolverInfo& infoGlobal);
btScalar solveSingleIteration(int iteration, btCollisionObject** bodies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); btScalar solveSingleIteration(int iteration, btCollisionObject** bodies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer);
virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer);
virtual btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); virtual btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer);
public: public:
@ -112,7 +111,7 @@ public:
btSequentialImpulseConstraintSolver(); btSequentialImpulseConstraintSolver();
virtual ~btSequentialImpulseConstraintSolver(); virtual ~btSequentialImpulseConstraintSolver();
virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& info, btIDebugDraw* debugDrawer, btStackAlloc* stackAlloc,btDispatcher* dispatcher); virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& info, btIDebugDraw* debugDrawer,btDispatcher* dispatcher);

View File

@ -87,7 +87,6 @@ struct InplaceSolverIslandCallback : public btSimulationIslandManager::IslandCal
btTypedConstraint** m_sortedConstraints; btTypedConstraint** m_sortedConstraints;
int m_numConstraints; int m_numConstraints;
btIDebugDraw* m_debugDrawer; btIDebugDraw* m_debugDrawer;
btStackAlloc* m_stackAlloc;
btDispatcher* m_dispatcher; btDispatcher* m_dispatcher;
btAlignedObjectArray<btCollisionObject*> m_bodies; btAlignedObjectArray<btCollisionObject*> m_bodies;
@ -104,7 +103,6 @@ struct InplaceSolverIslandCallback : public btSimulationIslandManager::IslandCal
m_sortedConstraints(NULL), m_sortedConstraints(NULL),
m_numConstraints(0), m_numConstraints(0),
m_debugDrawer(NULL), m_debugDrawer(NULL),
m_stackAlloc(stackAlloc),
m_dispatcher(dispatcher) m_dispatcher(dispatcher)
{ {
@ -135,7 +133,7 @@ struct InplaceSolverIslandCallback : public btSimulationIslandManager::IslandCal
if (islandId<0) if (islandId<0)
{ {
///we don't split islands, so all constraints/contact manifolds/bodies are passed into the solver regardless the island id ///we don't split islands, so all constraints/contact manifolds/bodies are passed into the solver regardless the island id
m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,&m_sortedConstraints[0],m_numConstraints,*m_solverInfo,m_debugDrawer,m_stackAlloc,m_dispatcher); m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,&m_sortedConstraints[0],m_numConstraints,*m_solverInfo,m_debugDrawer,m_dispatcher);
} else } else
{ {
//also add all non-contact constraints/joints for this island //also add all non-contact constraints/joints for this island
@ -163,7 +161,7 @@ struct InplaceSolverIslandCallback : public btSimulationIslandManager::IslandCal
if (m_solverInfo->m_minimumSolverBatchSize<=1) if (m_solverInfo->m_minimumSolverBatchSize<=1)
{ {
m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,startConstraint,numCurConstraints,*m_solverInfo,m_debugDrawer,m_stackAlloc,m_dispatcher); m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,startConstraint,numCurConstraints,*m_solverInfo,m_debugDrawer,m_dispatcher);
} else } else
{ {
@ -190,7 +188,7 @@ struct InplaceSolverIslandCallback : public btSimulationIslandManager::IslandCal
btPersistentManifold** manifold = m_manifolds.size()?&m_manifolds[0]:0; btPersistentManifold** manifold = m_manifolds.size()?&m_manifolds[0]:0;
btTypedConstraint** constraints = m_constraints.size()?&m_constraints[0]:0; btTypedConstraint** constraints = m_constraints.size()?&m_constraints[0]:0;
m_solver->solveGroup( bodies,m_bodies.size(),manifold, m_manifolds.size(),constraints, m_constraints.size() ,*m_solverInfo,m_debugDrawer,m_stackAlloc,m_dispatcher); m_solver->solveGroup( bodies,m_bodies.size(),manifold, m_manifolds.size(),constraints, m_constraints.size() ,*m_solverInfo,m_debugDrawer,m_dispatcher);
m_bodies.resize(0); m_bodies.resize(0);
m_manifolds.resize(0); m_manifolds.resize(0);
m_constraints.resize(0); m_constraints.resize(0);
@ -232,7 +230,7 @@ m_profileTimings(0)
{ {
void* mem = btAlignedAlloc(sizeof(InplaceSolverIslandCallback),16); void* mem = btAlignedAlloc(sizeof(InplaceSolverIslandCallback),16);
m_solverIslandCallback = new (mem) InplaceSolverIslandCallback (m_constraintSolver, m_stackAlloc, dispatcher); m_solverIslandCallback = new (mem) InplaceSolverIslandCallback (m_constraintSolver, 0, dispatcher);
} }
} }
@ -724,7 +722,7 @@ void btDiscreteDynamicsWorld::solveConstraints(btContactSolverInfo& solverInfo)
m_solverIslandCallback->processConstraints(); m_solverIslandCallback->processConstraints();
m_constraintSolver->allSolved(solverInfo, m_debugDrawer, m_stackAlloc); m_constraintSolver->allSolved(solverInfo, m_debugDrawer);
} }

View File

@ -33,7 +33,8 @@ enum btDynamicsWorldType
BT_SIMPLE_DYNAMICS_WORLD=1, BT_SIMPLE_DYNAMICS_WORLD=1,
BT_DISCRETE_DYNAMICS_WORLD=2, BT_DISCRETE_DYNAMICS_WORLD=2,
BT_CONTINUOUS_DYNAMICS_WORLD=3, BT_CONTINUOUS_DYNAMICS_WORLD=3,
BT_SOFT_RIGID_DYNAMICS_WORLD=4 BT_SOFT_RIGID_DYNAMICS_WORLD=4,
BT_GPU_DYNAMICS_WORLD=5
}; };
///The btDynamicsWorld is the interface class for several dynamics implementation, basic, discrete, parallel, and continuous etc. ///The btDynamicsWorld is the interface class for several dynamics implementation, basic, discrete, parallel, and continuous etc.

View File

@ -78,8 +78,8 @@ int btSimpleDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps, b
btContactSolverInfo infoGlobal; btContactSolverInfo infoGlobal;
infoGlobal.m_timeStep = timeStep; infoGlobal.m_timeStep = timeStep;
m_constraintSolver->prepareSolve(0,numManifolds); m_constraintSolver->prepareSolve(0,numManifolds);
m_constraintSolver->solveGroup(&getCollisionObjectArray()[0],getNumCollisionObjects(),manifoldPtr, numManifolds,0,0,infoGlobal,m_debugDrawer, m_stackAlloc,m_dispatcher1); m_constraintSolver->solveGroup(&getCollisionObjectArray()[0],getNumCollisionObjects(),manifoldPtr, numManifolds,0,0,infoGlobal,m_debugDrawer, m_dispatcher1);
m_constraintSolver->allSolved(infoGlobal,m_debugDrawer, m_stackAlloc); m_constraintSolver->allSolved(infoGlobal,m_debugDrawer);
} }
///integrate transforms ///integrate transforms

View File

@ -20,7 +20,6 @@ subject to the following restrictions:
class btStackAlloc;
class btIDebugDraw; class btIDebugDraw;
#include "BulletCollision/NarrowphaseCollision/btConvexPenetrationDepthSolver.h" #include "BulletCollision/NarrowphaseCollision/btConvexPenetrationDepthSolver.h"
@ -37,7 +36,7 @@ public:
void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB, void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB,
btTransform& transA,const btTransform& transB, btTransform& transA,const btTransform& transB,
btVector3& v, btVector3& pa, btVector3& pb, btVector3& v, btVector3& pa, btVector3& pb,
class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc, class btIDebugDraw* debugDraw,
struct SpuConvexPolyhedronVertexData* convexVertexDataA, struct SpuConvexPolyhedronVertexData* convexVertexDataA,
struct SpuConvexPolyhedronVertexData* convexVertexDataB struct SpuConvexPolyhedronVertexData* convexVertexDataB
) const = 0; ) const = 0;

View File

@ -72,10 +72,9 @@ bool SpuMinkowskiPenetrationDepthSolver::calcPenDepth( btSimplexSolverInterface&
const btConvexShape* convexA,const btConvexShape* convexB, const btConvexShape* convexA,const btConvexShape* convexB,
const btTransform& transA,const btTransform& transB, const btTransform& transA,const btTransform& transB,
btVector3& v, btVector3& pa, btVector3& pb, btVector3& v, btVector3& pa, btVector3& pb,
class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc) class btIDebugDraw* debugDraw)
{ {
#if 0 #if 0
(void)stackAlloc;
(void)v; (void)v;

View File

@ -20,7 +20,6 @@ subject to the following restrictions:
#include "BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h" #include "BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h"
class btStackAlloc;
class btIDebugDraw; class btIDebugDraw;
class btVoronoiSimplexSolver; class btVoronoiSimplexSolver;
class btConvexShape; class btConvexShape;
@ -37,7 +36,7 @@ public:
const btConvexShape* convexA,const btConvexShape* convexB, const btConvexShape* convexA,const btConvexShape* convexB,
const btTransform& transA,const btTransform& transB, const btTransform& transA,const btTransform& transB,
btVector3& v, btVector3& pa, btVector3& pb, btVector3& v, btVector3& pa, btVector3& pb,
class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc class btIDebugDraw* debugDraw
); );

View File

@ -1163,7 +1163,7 @@ btParallelConstraintSolver::~btParallelConstraintSolver()
btScalar btParallelConstraintSolver::solveGroup(btCollisionObject** bodies1,int numRigidBodies,btPersistentManifold** manifoldPtr,int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal, btIDebugDraw* debugDrawer, btStackAlloc* stackAlloc,btDispatcher* dispatcher) btScalar btParallelConstraintSolver::solveGroup(btCollisionObject** bodies1,int numRigidBodies,btPersistentManifold** manifoldPtr,int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal, btIDebugDraw* debugDrawer,btDispatcher* dispatcher)
{ {
/* int sz = sizeof(PfxSolverBody); /* int sz = sizeof(PfxSolverBody);

View File

@ -279,7 +279,7 @@ public:
virtual ~btParallelConstraintSolver(); virtual ~btParallelConstraintSolver();
virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& info, btIDebugDraw* debugDrawer, btStackAlloc* stackAlloc,btDispatcher* dispatcher); virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& info, btIDebugDraw* debugDrawer,btDispatcher* dispatcher);
}; };

View File

@ -17,7 +17,6 @@ subject to the following restrictions:
#define BT_SERIALIZER_H #define BT_SERIALIZER_H
#include "btScalar.h" // has definitions like SIMD_FORCE_INLINE #include "btScalar.h" // has definitions like SIMD_FORCE_INLINE
#include "btStackAlloc.h"
#include "btHashMap.h" #include "btHashMap.h"
#if !defined( __CELLOS_LV2__) && !defined(__MWERKS__) #if !defined( __CELLOS_LV2__) && !defined(__MWERKS__)