Fixes for broadphase/paircache determinism.
Revert definition for ATTRIBUTE_ALIGNED16, and try to force sizeof(btSolverConstraint) by using unions with btScalar, for non-btScalar data types. Use btAssert and not assert. Don't access btAlignedObjectArray elements, for zero sets
This commit is contained in:
@@ -1262,33 +1262,27 @@ void DemoApplication::clientResetScene()
|
||||
|
||||
gNumClampedCcdMotions = 0;
|
||||
int numObjects = 0;
|
||||
int i;
|
||||
|
||||
if (m_dynamicsWorld)
|
||||
{
|
||||
numObjects = m_dynamicsWorld->getNumCollisionObjects();
|
||||
}
|
||||
|
||||
#ifdef TEST_DETERMINISM
|
||||
btCollisionObjectArray copyArray = m_dynamicsWorld->getCollisionObjectArray();
|
||||
|
||||
for (int i=0;i<copyArray.size();i++)
|
||||
for (i=0;i<copyArray.size();i++)
|
||||
{
|
||||
btRigidBody* body = btRigidBody::upcast(copyArray[i]);
|
||||
if (body)
|
||||
m_dynamicsWorld->removeRigidBody(body);
|
||||
}
|
||||
|
||||
for (int i=0;i<copyArray.size();i++)
|
||||
{
|
||||
btRigidBody* body = btRigidBody::upcast(copyArray[i]);
|
||||
if (body)
|
||||
m_dynamicsWorld->addRigidBody(btRigidBody::upcast(copyArray[i]));
|
||||
}
|
||||
#endif //TEST_DETERMINISM
|
||||
|
||||
|
||||
for (int i=0;i<numObjects;i++)
|
||||
for (i=0;i<numObjects;i++)
|
||||
{
|
||||
btCollisionObject* colObj = m_dynamicsWorld->getCollisionObjectArray()[i];
|
||||
btCollisionObject* colObj = copyArray[i];
|
||||
btRigidBody* body = btRigidBody::upcast(colObj);
|
||||
if (body)
|
||||
{
|
||||
@@ -1304,7 +1298,7 @@ void DemoApplication::clientResetScene()
|
||||
//colObj->setActivationState(WANTS_DEACTIVATION);
|
||||
}
|
||||
//removed cached contact points
|
||||
m_dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(colObj->getBroadphaseHandle(),getDynamicsWorld()->getDispatcher());
|
||||
//m_dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(colObj->getBroadphaseHandle(),getDynamicsWorld()->getDispatcher());
|
||||
|
||||
btRigidBody* body = btRigidBody::upcast(colObj);
|
||||
if (body && !body->isStaticObject())
|
||||
@@ -1318,7 +1312,13 @@ void DemoApplication::clientResetScene()
|
||||
|
||||
m_dynamicsWorld->getBroadphase()->resetPool(getDynamicsWorld()->getDispatcher());
|
||||
|
||||
m_dynamicsWorld->getPairCache()->sortOverlappingPairs(getDynamicsWorld()->getDispatcher());
|
||||
for ( i=0;i<copyArray.size();i++)
|
||||
{
|
||||
btRigidBody* body = btRigidBody::upcast(copyArray[i]);
|
||||
if (body)
|
||||
m_dynamicsWorld->addRigidBody(btRigidBody::upcast(copyArray[i]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ void GL_ShapeDrawer::drawCylinder(float radius,float halfHeight, int upAxis)
|
||||
break;
|
||||
default:
|
||||
{
|
||||
assert(0);
|
||||
btAssert(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ bool Raytracer::worldRaytest(const btVector3& rayFrom,const btVector3& rayTo,btV
|
||||
{
|
||||
|
||||
//caller already does the filter on the m_closestHitFraction
|
||||
assert(rayResult.m_hitFraction <= m_closestHitFraction);
|
||||
btAssert(rayResult.m_hitFraction <= m_closestHitFraction);
|
||||
|
||||
m_closestHitFraction = rayResult.m_hitFraction;
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
#include "btAxisSweep3.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
btAxisSweep3::btAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned short int maxHandles, btOverlappingPairCache* pairCache, bool disableRaycastAccelerator)
|
||||
:btAxisSweep3Internal<unsigned short int>(worldAabbMin,worldAabbMax,0xfffe,0xffff,maxHandles,pairCache,disableRaycastAccelerator)
|
||||
|
||||
@@ -221,7 +221,7 @@ void btAxisSweep3<BP_FP_INT_TYPE>::debugPrintAxis(int axis, bool checkCardinalit
|
||||
}
|
||||
|
||||
if (checkCardinality)
|
||||
assert(numEdges == m_numHandles*2+1);
|
||||
btAssert(numEdges == m_numHandles*2+1);
|
||||
}
|
||||
#endif //DEBUG_BROADPHASE
|
||||
|
||||
@@ -347,7 +347,7 @@ m_raycastAccelerator(0)
|
||||
m_raycastAccelerator->m_deferedcollide = true;//don't add/remove pairs
|
||||
}
|
||||
|
||||
//assert(bounds.HasVolume());
|
||||
//btAssert(bounds.HasVolume());
|
||||
|
||||
// init bounds
|
||||
m_worldAabbMin = worldAabbMin;
|
||||
@@ -453,7 +453,7 @@ void btAxisSweep3Internal<BP_FP_INT_TYPE>::quantize(BP_FP_INT_TYPE* out, const b
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::allocHandle()
|
||||
{
|
||||
assert(m_firstFreeHandle);
|
||||
btAssert(m_firstFreeHandle);
|
||||
|
||||
BP_FP_INT_TYPE handle = m_firstFreeHandle;
|
||||
m_firstFreeHandle = getHandle(handle)->GetNextFree();
|
||||
@@ -465,7 +465,7 @@ BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::allocHandle()
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::freeHandle(BP_FP_INT_TYPE handle)
|
||||
{
|
||||
assert(handle > 0 && handle < m_maxHandles);
|
||||
btAssert(handle > 0 && handle < m_maxHandles);
|
||||
|
||||
getHandle(handle)->SetNextFree(m_firstFreeHandle);
|
||||
m_firstFreeHandle = handle;
|
||||
@@ -611,8 +611,83 @@ void btAxisSweep3Internal<BP_FP_INT_TYPE>::calculateOverlappingPairs(btDispatche
|
||||
|
||||
if (m_pairCache->hasDeferredRemoval())
|
||||
{
|
||||
m_pairCache->performDeferredRemoval(dispatcher);
|
||||
|
||||
btBroadphasePairArray& overlappingPairArray = m_pairCache->getOverlappingPairArray();
|
||||
|
||||
//perform a sort, to find duplicates and to sort 'invalid' pairs to the end
|
||||
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
|
||||
|
||||
overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair);
|
||||
m_invalidPair = 0;
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
btBroadphasePair previousPair;
|
||||
previousPair.m_pProxy0 = 0;
|
||||
previousPair.m_pProxy1 = 0;
|
||||
previousPair.m_algorithm = 0;
|
||||
|
||||
|
||||
for (i=0;i<overlappingPairArray.size();i++)
|
||||
{
|
||||
|
||||
btBroadphasePair& pair = overlappingPairArray[i];
|
||||
|
||||
bool isDuplicate = (pair == previousPair);
|
||||
|
||||
previousPair = pair;
|
||||
|
||||
bool needsRemoval = false;
|
||||
|
||||
if (!isDuplicate)
|
||||
{
|
||||
///important to use an AABB test that is consistent with the broadphase
|
||||
bool hasOverlap = testAabbOverlap(pair.m_pProxy0,pair.m_pProxy1);
|
||||
|
||||
if (hasOverlap)
|
||||
{
|
||||
needsRemoval = false;//callback->processOverlap(pair);
|
||||
} else
|
||||
{
|
||||
needsRemoval = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
//remove duplicate
|
||||
needsRemoval = true;
|
||||
//should have no algorithm
|
||||
btAssert(!pair.m_algorithm);
|
||||
}
|
||||
|
||||
if (needsRemoval)
|
||||
{
|
||||
m_pairCache->cleanOverlappingPair(pair,dispatcher);
|
||||
|
||||
// m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
|
||||
// m_overlappingPairArray.pop_back();
|
||||
pair.m_pProxy0 = 0;
|
||||
pair.m_pProxy1 = 0;
|
||||
m_invalidPair++;
|
||||
gOverlappingPairs--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///if you don't like to skip the invalid pairs in the array, execute following code:
|
||||
#define CLEAN_INVALID_PAIRS 1
|
||||
#ifdef CLEAN_INVALID_PAIRS
|
||||
|
||||
//perform a sort, to sort 'invalid' pairs to the end
|
||||
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
|
||||
|
||||
overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair);
|
||||
m_invalidPair = 0;
|
||||
#endif//CLEAN_INVALID_PAIRS
|
||||
|
||||
//printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -653,8 +728,8 @@ bool btAxisSweep3Internal<BP_FP_INT_TYPE>::testOverlap2D(const Handle* pHandleA,
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher)
|
||||
{
|
||||
// assert(bounds.IsFinite());
|
||||
//assert(bounds.HasVolume());
|
||||
// btAssert(bounds.IsFinite());
|
||||
//btAssert(bounds.HasVolume());
|
||||
|
||||
Handle* pHandle = getHandle(handle);
|
||||
|
||||
|
||||
@@ -424,9 +424,14 @@ btDbvt::~btDbvt()
|
||||
//
|
||||
void btDbvt::clear()
|
||||
{
|
||||
if(m_root) recursedeletenode(this,m_root);
|
||||
if(m_root)
|
||||
recursedeletenode(this,m_root);
|
||||
btAlignedFree(m_free);
|
||||
m_free=0;
|
||||
m_lkhd = -1;
|
||||
m_stkStack.clear();
|
||||
m_opath = 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -133,9 +133,7 @@ btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache* paircache)
|
||||
m_updates_call = 0;
|
||||
m_updates_done = 0;
|
||||
m_updates_ratio = 0;
|
||||
m_paircache = paircache?
|
||||
paircache :
|
||||
new(btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16)) btHashedOverlappingPairCache();
|
||||
m_paircache = paircache? paircache : new(btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16)) btHashedOverlappingPairCache();
|
||||
m_gid = 0;
|
||||
m_pid = 0;
|
||||
m_cid = 0;
|
||||
@@ -342,16 +340,102 @@ void btDbvtBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher)
|
||||
}
|
||||
#endif
|
||||
|
||||
performDeferredRemoval(dispatcher);
|
||||
|
||||
}
|
||||
|
||||
void btDbvtBroadphase::performDeferredRemoval(btDispatcher* dispatcher)
|
||||
{
|
||||
|
||||
if (m_paircache->hasDeferredRemoval())
|
||||
{
|
||||
m_paircache->performDeferredRemoval(dispatcher);
|
||||
}
|
||||
|
||||
btBroadphasePairArray& overlappingPairArray = m_paircache->getOverlappingPairArray();
|
||||
|
||||
//perform a sort, to find duplicates and to sort 'invalid' pairs to the end
|
||||
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
|
||||
|
||||
int invalidPair = 0;
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
btBroadphasePair previousPair;
|
||||
previousPair.m_pProxy0 = 0;
|
||||
previousPair.m_pProxy1 = 0;
|
||||
previousPair.m_algorithm = 0;
|
||||
|
||||
|
||||
for (i=0;i<overlappingPairArray.size();i++)
|
||||
{
|
||||
|
||||
btBroadphasePair& pair = overlappingPairArray[i];
|
||||
|
||||
bool isDuplicate = (pair == previousPair);
|
||||
|
||||
previousPair = pair;
|
||||
|
||||
bool needsRemoval = false;
|
||||
|
||||
if (!isDuplicate)
|
||||
{
|
||||
//important to perform AABB check that is consistent with the broadphase
|
||||
btDbvtProxy* pa=(btDbvtProxy*)pair.m_pProxy0;
|
||||
btDbvtProxy* pb=(btDbvtProxy*)pair.m_pProxy1;
|
||||
bool hasOverlap = Intersect(pa->leaf->volume,pb->leaf->volume);
|
||||
|
||||
if (hasOverlap)
|
||||
{
|
||||
needsRemoval = false;
|
||||
} else
|
||||
{
|
||||
needsRemoval = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
//remove duplicate
|
||||
needsRemoval = true;
|
||||
//should have no algorithm
|
||||
btAssert(!pair.m_algorithm);
|
||||
}
|
||||
|
||||
if (needsRemoval)
|
||||
{
|
||||
m_paircache->cleanOverlappingPair(pair,dispatcher);
|
||||
|
||||
pair.m_pProxy0 = 0;
|
||||
pair.m_pProxy1 = 0;
|
||||
invalidPair++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//perform a sort, to sort 'invalid' pairs to the end
|
||||
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
|
||||
overlappingPairArray.resize(overlappingPairArray.size() - invalidPair);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
void btDbvtBroadphase::collide(btDispatcher* dispatcher)
|
||||
{
|
||||
/*printf("---------------------------------------------------------\n");
|
||||
printf("m_sets[0].m_leaves=%d\n",m_sets[0].m_leaves);
|
||||
printf("m_sets[1].m_leaves=%d\n",m_sets[1].m_leaves);
|
||||
printf("numPairs = %d\n",getOverlappingPairCache()->getNumOverlappingPairs());
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<getOverlappingPairCache()->getNumOverlappingPairs();i++)
|
||||
{
|
||||
printf("pair[%d]=(%d,%d),",i,getOverlappingPairCache()->getOverlappingPairArray()[i].m_pProxy0->getUid(),
|
||||
getOverlappingPairCache()->getOverlappingPairArray()[i].m_pProxy1->getUid());
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
SPC(m_profiling.m_total);
|
||||
/* optimize */
|
||||
m_sets[0].optimizeIncremental(1+(m_sets[0].m_leaves*m_dupdates)/100);
|
||||
@@ -407,11 +491,11 @@ void btDbvtBroadphase::collide(btDispatcher* dispatcher)
|
||||
btBroadphasePairArray& pairs=m_paircache->getOverlappingPairArray();
|
||||
if(pairs.size()>0)
|
||||
{
|
||||
const int ci=pairs.size();
|
||||
int ni=btMin(ci,btMax<int>(m_newpairs,(ci*m_cupdates)/100));
|
||||
|
||||
int ni=btMin(pairs.size(),btMax<int>(m_newpairs,(pairs.size()*m_cupdates)/100));
|
||||
for(int i=0;i<ni;++i)
|
||||
{
|
||||
btBroadphasePair& p=pairs[(m_cid+i)%ci];
|
||||
btBroadphasePair& p=pairs[(m_cid+i)%pairs.size()];
|
||||
btDbvtProxy* pa=(btDbvtProxy*)p.m_pProxy0;
|
||||
btDbvtProxy* pb=(btDbvtProxy*)p.m_pProxy1;
|
||||
if(!Intersect(pa->leaf->volume,pb->leaf->volume))
|
||||
@@ -477,26 +561,35 @@ void btDbvtBroadphase::getBroadphaseAabb(btVector3& aabbMin,btVector3& aab
|
||||
|
||||
void btDbvtBroadphase::resetPool(btDispatcher* dispatcher)
|
||||
{
|
||||
return;
|
||||
m_sets[0].optimizeBottomUp();
|
||||
m_sets[1].optimizeBottomUp();
|
||||
|
||||
|
||||
btDbvtProxy* current=m_stageRoots[m_stageCurrent];
|
||||
if(current)
|
||||
int totalObjects = m_sets[0].m_leaves + m_sets[1].m_leaves;
|
||||
if (!totalObjects)
|
||||
{
|
||||
btDbvtTreeCollider collider(this);
|
||||
do {
|
||||
btDbvtProxy* next=current->links[1];
|
||||
listremove(current,m_stageRoots[current->stage]);
|
||||
listappend(current,m_stageRoots[m_stageCurrent]);
|
||||
current->stage = m_stageCurrent;
|
||||
current = next;
|
||||
} while(current);
|
||||
//reset internal dynamic tree data structures
|
||||
m_sets[0].clear();
|
||||
m_sets[1].clear();
|
||||
|
||||
m_deferedcollide = false;
|
||||
m_needcleanup = true;
|
||||
m_prediction = 1/(btScalar)2;
|
||||
m_stageCurrent = 0;
|
||||
m_fixedleft = 0;
|
||||
m_fupdates = 1;
|
||||
m_dupdates = 0;
|
||||
m_cupdates = 10;
|
||||
m_newpairs = 1;
|
||||
m_updates_call = 0;
|
||||
m_updates_done = 0;
|
||||
m_updates_ratio = 0;
|
||||
|
||||
m_gid = 0;
|
||||
m_pid = 0;
|
||||
m_cid = 0;
|
||||
for(int i=0;i<=STAGECOUNT;++i)
|
||||
{
|
||||
m_stageRoots[i]=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -115,6 +115,9 @@ struct btDbvtBroadphase : btBroadphaseInterface
|
||||
void printStats();
|
||||
static void benchmark(btBroadphaseInterface*);
|
||||
|
||||
|
||||
void performDeferredRemoval(btDispatcher* dispatcher);
|
||||
|
||||
///reset broadphase internal structures, to ensure determinism/reproducability
|
||||
virtual void resetPool(btDispatcher* dispatcher);
|
||||
|
||||
|
||||
@@ -462,7 +462,7 @@ void* btSortedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* pro
|
||||
btBroadphasePair* btSortedOverlappingPairCache::addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
|
||||
{
|
||||
//don't add overlap with own
|
||||
assert(proxy0 != proxy1);
|
||||
btAssert(proxy0 != proxy1);
|
||||
|
||||
if (!needsBroadphaseCollision(proxy0,proxy1))
|
||||
return 0;
|
||||
@@ -493,7 +493,7 @@ btBroadphasePair* btSortedOverlappingPairCache::addOverlappingPair(btBroadphaseP
|
||||
|
||||
if (findIndex < m_overlappingPairArray.size())
|
||||
{
|
||||
//assert(it != m_overlappingPairSet.end());
|
||||
//btAssert(it != m_overlappingPairSet.end());
|
||||
btBroadphasePair* pair = &m_overlappingPairArray[findIndex];
|
||||
return pair;
|
||||
}
|
||||
@@ -631,70 +631,3 @@ void btSortedOverlappingPairCache::sortOverlappingPairs(btDispatcher* dispatcher
|
||||
//should already be sorted
|
||||
}
|
||||
|
||||
|
||||
|
||||
void btSortedOverlappingPairCache::performDeferredRemoval(btDispatcher* dispatcher)
|
||||
{
|
||||
|
||||
btBroadphasePairArray& overlappingPairArray = getOverlappingPairArray();
|
||||
|
||||
//perform a sort, to find duplicates and to sort 'invalid' pairs to the end
|
||||
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
|
||||
|
||||
int invalidPair = 0;
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
btBroadphasePair previousPair;
|
||||
previousPair.m_pProxy0 = 0;
|
||||
previousPair.m_pProxy1 = 0;
|
||||
previousPair.m_algorithm = 0;
|
||||
|
||||
|
||||
for (i=0;i<overlappingPairArray.size();i++)
|
||||
{
|
||||
|
||||
btBroadphasePair& pair = overlappingPairArray[i];
|
||||
|
||||
bool isDuplicate = (pair == previousPair);
|
||||
|
||||
previousPair = pair;
|
||||
|
||||
bool needsRemoval = false;
|
||||
|
||||
if (!isDuplicate)
|
||||
{
|
||||
|
||||
bool hasOverlap = TestAabbAgainstAabb2(pair.m_pProxy0->m_aabbMin,pair.m_pProxy0->m_aabbMax,pair.m_pProxy1->m_aabbMin,pair.m_pProxy1->m_aabbMax);
|
||||
|
||||
if (hasOverlap)
|
||||
{
|
||||
needsRemoval = false;
|
||||
} else
|
||||
{
|
||||
needsRemoval = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
//remove duplicate
|
||||
needsRemoval = true;
|
||||
//should have no algorithm
|
||||
btAssert(!pair.m_algorithm);
|
||||
}
|
||||
|
||||
if (needsRemoval)
|
||||
{
|
||||
cleanOverlappingPair(pair,dispatcher);
|
||||
|
||||
pair.m_pProxy0 = 0;
|
||||
pair.m_pProxy1 = 0;
|
||||
invalidPair++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//perform a sort, to sort 'invalid' pairs to the end
|
||||
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
|
||||
overlappingPairArray.resize(overlappingPairArray.size() - invalidPair);
|
||||
}
|
||||
@@ -86,7 +86,6 @@ public:
|
||||
|
||||
virtual void sortOverlappingPairs(btDispatcher* dispatcher) = 0;
|
||||
|
||||
virtual void performDeferredRemoval(btDispatcher* dispatcher) = 0;
|
||||
|
||||
};
|
||||
|
||||
@@ -265,10 +264,6 @@ private:
|
||||
|
||||
virtual void sortOverlappingPairs(btDispatcher* dispatcher);
|
||||
|
||||
virtual void performDeferredRemoval(btDispatcher* dispatcher)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -382,8 +377,6 @@ class btSortedOverlappingPairCache : public btOverlappingPairCache
|
||||
|
||||
virtual void sortOverlappingPairs(btDispatcher* dispatcher);
|
||||
|
||||
void performDeferredRemoval(btDispatcher* dispatcher);
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -466,9 +459,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void performDeferredRemoval(btDispatcher* dispatcher)
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ btCollisionDispatcher::btCollisionDispatcher (btCollisionConfiguration* collisio
|
||||
for (int j=0;j<MAX_BROADPHASE_COLLISION_TYPES;j++)
|
||||
{
|
||||
m_doubleDispatch[i][j] = m_collisionConfiguration->getCollisionAlgorithmCreateFunc(i,j);
|
||||
assert(m_doubleDispatch[i][j]);
|
||||
btAssert(m_doubleDispatch[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,8 +160,8 @@ bool btCollisionDispatcher::needsResponse(btCollisionObject* body0,btCollisionOb
|
||||
|
||||
bool btCollisionDispatcher::needsCollision(btCollisionObject* body0,btCollisionObject* body1)
|
||||
{
|
||||
assert(body0);
|
||||
assert(body1);
|
||||
btAssert(body0);
|
||||
btAssert(body1);
|
||||
|
||||
bool needsCollision = true;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ m_sharedManifold(ci.m_manifold)
|
||||
m_ownsManifold = false;
|
||||
|
||||
btCollisionObject* colObj = m_isSwapped? body1 : body0;
|
||||
assert (colObj->getCollisionShape()->isCompound());
|
||||
btAssert (colObj->getCollisionShape()->isCompound());
|
||||
|
||||
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
|
||||
m_compoundShapeRevision = compoundShape->getUpdateRevision();
|
||||
@@ -41,7 +41,7 @@ void btCompoundCollisionAlgorithm::preallocateChildAlgorithms(btCollisionObject*
|
||||
{
|
||||
btCollisionObject* colObj = m_isSwapped? body1 : body0;
|
||||
btCollisionObject* otherObj = m_isSwapped? body0 : body1;
|
||||
assert (colObj->getCollisionShape()->isCompound());
|
||||
btAssert (colObj->getCollisionShape()->isCompound());
|
||||
|
||||
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
|
||||
|
||||
@@ -186,7 +186,7 @@ void btCompoundCollisionAlgorithm::processCollision (btCollisionObject* body0,bt
|
||||
|
||||
|
||||
|
||||
assert (colObj->getCollisionShape()->isCompound());
|
||||
btAssert (colObj->getCollisionShape()->isCompound());
|
||||
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
|
||||
|
||||
///btCompoundShape might have changed:
|
||||
@@ -296,7 +296,7 @@ btScalar btCompoundCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject*
|
||||
btCollisionObject* colObj = m_isSwapped? body1 : body0;
|
||||
btCollisionObject* otherObj = m_isSwapped? body0 : body1;
|
||||
|
||||
assert (colObj->getCollisionShape()->isCompound());
|
||||
btAssert (colObj->getCollisionShape()->isCompound());
|
||||
|
||||
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ btManifoldResult::btManifoldResult(btCollisionObject* body0,btCollisionObject* b
|
||||
|
||||
void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth)
|
||||
{
|
||||
assert(m_manifoldPtr);
|
||||
btAssert(m_manifoldPtr);
|
||||
//order in manifold needs to match
|
||||
|
||||
if (depth > m_manifoldPtr->getContactBreakingThreshold())
|
||||
|
||||
@@ -43,10 +43,10 @@ void btSimulationIslandManager::findUnions(btDispatcher* /* dispatcher */,btColl
|
||||
{
|
||||
|
||||
{
|
||||
btBroadphasePair* pairPtr = colWorld->getPairCache()->getOverlappingPairArrayPtr();
|
||||
|
||||
for (int i=0;i<colWorld->getPairCache()->getNumOverlappingPairs();i++)
|
||||
{
|
||||
btBroadphasePair* pairPtr = colWorld->getPairCache()->getOverlappingPairArrayPtr();
|
||||
const btBroadphasePair& collisionPair = pairPtr[i];
|
||||
btCollisionObject* colObj0 = (btCollisionObject*)collisionPair.m_pProxy0->m_clientObject;
|
||||
btCollisionObject* colObj1 = (btCollisionObject*)collisionPair.m_pProxy1->m_clientObject;
|
||||
@@ -185,7 +185,7 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher,btCollisio
|
||||
// printf("error in island management\n");
|
||||
}
|
||||
|
||||
assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
if (colObj0->getIslandTag() == islandId)
|
||||
{
|
||||
if (colObj0->getActivationState()== ACTIVE_TAG)
|
||||
@@ -212,7 +212,7 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher,btCollisio
|
||||
// printf("error in island management\n");
|
||||
}
|
||||
|
||||
assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
|
||||
if (colObj0->getIslandTag() == islandId)
|
||||
{
|
||||
@@ -233,7 +233,7 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher,btCollisio
|
||||
// printf("error in island management\n");
|
||||
}
|
||||
|
||||
assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
|
||||
if (colObj0->getIslandTag() == islandId)
|
||||
{
|
||||
|
||||
@@ -14,8 +14,6 @@ subject to the following restrictions:
|
||||
*/
|
||||
|
||||
#include "btUnionFind.h"
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -98,8 +98,8 @@ class btUnionFind
|
||||
|
||||
int find(int x)
|
||||
{
|
||||
//assert(x < m_N);
|
||||
//assert(x >= 0);
|
||||
//btAssert(x < m_N);
|
||||
//btAssert(x >= 0);
|
||||
|
||||
while (x != m_elements[x].m_id)
|
||||
{
|
||||
@@ -110,8 +110,8 @@ class btUnionFind
|
||||
m_elements[x].m_id = m_elements[m_elements[x].m_id].m_id;
|
||||
#endif //
|
||||
x = m_elements[x].m_id;
|
||||
//assert(x < m_N);
|
||||
//assert(x >= 0);
|
||||
//btAssert(x < m_N);
|
||||
//btAssert(x >= 0);
|
||||
|
||||
}
|
||||
return x;
|
||||
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
plane.setValue(btScalar(0.),btScalar(0.),btScalar(-1.),-halfExtents.z());
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
btAssert(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ public:
|
||||
penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(-1.));
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
btAssert(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ void btConeShape::setConeUpIndex(int upIndex)
|
||||
m_coneIndices[2] = 1;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
btAssert(0);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ void btConvexHullShape::getPlane(btVector3& ,btVector3& ,int ) const
|
||||
//not yet
|
||||
bool btConvexHullShape::isInside(const btVector3& ,btScalar ) const
|
||||
{
|
||||
assert(0);
|
||||
btAssert(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ void btConvexPointCloudShape::getPlane(btVector3& ,btVector3& ,int ) const
|
||||
//not yet
|
||||
bool btConvexPointCloudShape::isInside(const btVector3& ,btScalar ) const
|
||||
{
|
||||
assert(0);
|
||||
btAssert(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@ m_weldingThreshold(0.0)
|
||||
if (m_use32bitIndices)
|
||||
{
|
||||
m_indexedMeshes[0].m_numTriangles = m_32bitIndices.size()/3;
|
||||
m_indexedMeshes[0].m_triangleIndexBase = (unsigned char*) &m_32bitIndices[0];
|
||||
m_indexedMeshes[0].m_triangleIndexBase = 0;
|
||||
m_indexedMeshes[0].m_indexType = PHY_INTEGER;
|
||||
m_indexedMeshes[0].m_triangleIndexStride = 3*sizeof(int);
|
||||
} else
|
||||
{
|
||||
m_indexedMeshes[0].m_numTriangles = m_16bitIndices.size()/3;
|
||||
m_indexedMeshes[0].m_triangleIndexBase = (unsigned char*) &m_16bitIndices[0];
|
||||
m_indexedMeshes[0].m_triangleIndexBase = 0;
|
||||
m_indexedMeshes[0].m_indexType = PHY_SHORT;
|
||||
m_indexedMeshes[0].m_triangleIndexStride = 3*sizeof(short int);
|
||||
}
|
||||
@@ -49,12 +49,12 @@ m_weldingThreshold(0.0)
|
||||
if (m_use4componentVertices)
|
||||
{
|
||||
m_indexedMeshes[0].m_numVertices = m_4componentVertices.size();
|
||||
m_indexedMeshes[0].m_vertexBase = (unsigned char*)&m_4componentVertices[0];
|
||||
m_indexedMeshes[0].m_vertexBase = 0;
|
||||
m_indexedMeshes[0].m_vertexStride = sizeof(btVector3);
|
||||
} else
|
||||
{
|
||||
m_indexedMeshes[0].m_numVertices = m_3componentVertices.size()/3;
|
||||
m_indexedMeshes[0].m_vertexBase = (unsigned char*)&m_3componentVertices[0];
|
||||
m_indexedMeshes[0].m_vertexBase = 0;
|
||||
m_indexedMeshes[0].m_vertexStride = 3*sizeof(btScalar);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
assert(0);
|
||||
btAssert(0);
|
||||
return localGetSupportingVertex(vec);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@ subject to the following restrictions:
|
||||
|
||||
|
||||
#include "btVoronoiSimplexSolver.h"
|
||||
#include <assert.h>
|
||||
//#include <stdio.h>
|
||||
|
||||
#define VERTA 0
|
||||
#define VERTB 1
|
||||
@@ -37,7 +35,7 @@ subject to the following restrictions:
|
||||
void btVoronoiSimplexSolver::removeVertex(int index)
|
||||
{
|
||||
|
||||
assert(m_numVertices>0);
|
||||
btAssert(m_numVertices>0);
|
||||
m_numVertices--;
|
||||
m_simplexVectorW[index] = m_simplexVectorW[m_numVertices];
|
||||
m_simplexPointsP[index] = m_simplexPointsP[m_numVertices];
|
||||
|
||||
@@ -22,7 +22,7 @@ subject to the following restrictions:
|
||||
#include "LinearMath/btMinMax.h"
|
||||
#include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h"
|
||||
|
||||
#define ASSERT2 assert
|
||||
#define ASSERT2 btAssert
|
||||
|
||||
#define USE_INTERNAL_APPLY_IMPULSE 1
|
||||
|
||||
@@ -114,7 +114,7 @@ btScalar resolveSingleCollision(
|
||||
btScalar Kcor = Kerp *Kfps;
|
||||
|
||||
btConstraintPersistentData* cpd = (btConstraintPersistentData*) contactPoint.m_userPersistentData;
|
||||
assert(cpd);
|
||||
btAssert(cpd);
|
||||
btScalar distance = cpd->m_penetration;
|
||||
btScalar positionalError = Kcor *-distance;
|
||||
btScalar velocityError = cpd->m_restitution - rel_vel;// * damping;
|
||||
@@ -166,7 +166,7 @@ btScalar resolveSingleFriction(
|
||||
btVector3 rel_pos2 = pos2 - body2.getCenterOfMassPosition();
|
||||
|
||||
btConstraintPersistentData* cpd = (btConstraintPersistentData*) contactPoint.m_userPersistentData;
|
||||
assert(cpd);
|
||||
btAssert(cpd);
|
||||
|
||||
btScalar combinedFriction = cpd->m_friction;
|
||||
|
||||
@@ -255,7 +255,7 @@ btScalar resolveSingleFrictionOriginal(
|
||||
btVector3 rel_pos2 = pos2 - body2.getCenterOfMassPosition();
|
||||
|
||||
btConstraintPersistentData* cpd = (btConstraintPersistentData*) contactPoint.m_userPersistentData;
|
||||
assert(cpd);
|
||||
btAssert(cpd);
|
||||
|
||||
btScalar combinedFriction = cpd->m_friction;
|
||||
|
||||
@@ -337,7 +337,7 @@ btScalar resolveSingleCollisionCombined(
|
||||
btScalar Kcor = Kerp *Kfps;
|
||||
|
||||
btConstraintPersistentData* cpd = (btConstraintPersistentData*) contactPoint.m_userPersistentData;
|
||||
assert(cpd);
|
||||
btAssert(cpd);
|
||||
btScalar distance = cpd->m_penetration;
|
||||
btScalar positionalError = Kcor *-distance;
|
||||
btScalar velocityError = cpd->m_restitution - rel_vel;// * damping;
|
||||
|
||||
@@ -262,7 +262,6 @@ btSolverConstraint& btSequentialImpulseConstraintSolver::addFrictionConstraint(c
|
||||
|
||||
solverConstraint.m_solverBodyIdA = solverBodyIdA;
|
||||
solverConstraint.m_solverBodyIdB = solverBodyIdB;
|
||||
solverConstraint.m_constraintType = btSolverConstraint::BT_SOLVER_FRICTION_1D;
|
||||
solverConstraint.m_frictionIndex = frictionIndex;
|
||||
|
||||
solverConstraint.m_friction = cp.m_combinedFriction;
|
||||
@@ -465,6 +464,8 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol
|
||||
info2.m_J2linearAxis = 0;
|
||||
info2.m_J2angularAxis = currentConstraintRow->m_relpos2CrossNormal;
|
||||
info2.rowskip = sizeof(btSolverConstraint)/sizeof(btScalar);//check this
|
||||
///the size of btSolverConstraint needs be a multiple of btScalar
|
||||
btAssert(info2.rowskip*sizeof(btScalar)== sizeof(btSolverConstraint));
|
||||
info2.m_constraintError = ¤tConstraintRow->m_rhs;
|
||||
info2.cfm = ¤tConstraintRow->m_cfm;
|
||||
info2.m_lowerLimit = ¤tConstraintRow->m_lowerLimit;
|
||||
@@ -581,7 +582,6 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol
|
||||
|
||||
solverConstraint.m_solverBodyIdA = solverBodyIdA;
|
||||
solverConstraint.m_solverBodyIdB = solverBodyIdB;
|
||||
solverConstraint.m_constraintType = btSolverConstraint::BT_SOLVER_CONTACT_1D;
|
||||
|
||||
solverConstraint.m_originalContactPoint = &cp;
|
||||
|
||||
@@ -945,6 +945,9 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlyIterations(
|
||||
/// 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*/)
|
||||
{
|
||||
|
||||
|
||||
|
||||
BT_PROFILE("solveGroup");
|
||||
//we only implement SOLVER_CACHE_FRIENDLY now
|
||||
//you need to provide at least some bodies
|
||||
|
||||
@@ -49,9 +49,10 @@ struct btSimdScalar
|
||||
}
|
||||
union
|
||||
{
|
||||
__m128 m_vec128;
|
||||
float m_floats[4];
|
||||
int m_ints[4];
|
||||
__m128 m_vec128;
|
||||
float m_floats[4];
|
||||
int m_ints[4];
|
||||
btScalar m_unusedPadding;
|
||||
};
|
||||
SIMD_FORCE_INLINE __m128 get128()
|
||||
{
|
||||
|
||||
@@ -37,22 +37,40 @@ ATTRIBUTE_ALIGNED16 (struct) btSolverConstraint
|
||||
//btVector3 m_contactNormal2;//usually m_contactNormal2 == -m_contactNormal
|
||||
|
||||
btVector3 m_angularComponentA;
|
||||
btVector3 m_angularComponentB;
|
||||
btVector3 m_angularComponentB;
|
||||
|
||||
mutable btSimdScalar m_appliedPushImpulse;
|
||||
mutable btSimdScalar m_appliedImpulse;
|
||||
|
||||
int m_solverBodyIdA;
|
||||
int m_solverBodyIdB;
|
||||
|
||||
btScalar m_friction;
|
||||
btScalar m_restitution;
|
||||
btScalar m_jacDiagABInv;
|
||||
btScalar m_penetration;
|
||||
|
||||
int m_constraintType;
|
||||
int m_frictionIndex;
|
||||
void* m_originalContactPoint;
|
||||
|
||||
union
|
||||
{
|
||||
int m_frictionIndex;
|
||||
btScalar m_unusedPadding1;
|
||||
};
|
||||
union
|
||||
{
|
||||
int m_solverBodyIdA;
|
||||
btScalar m_unusedPadding2;
|
||||
};
|
||||
union
|
||||
{
|
||||
int m_solverBodyIdB;
|
||||
btScalar m_unusedPadding3;
|
||||
};
|
||||
|
||||
union
|
||||
{
|
||||
void* m_originalContactPoint;
|
||||
btScalar m_unusedPadding4;
|
||||
};
|
||||
|
||||
btScalar m_rhs;
|
||||
btScalar m_cfm;
|
||||
btScalar m_lowerLimit;
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
int m_numConstraintRows,nub;
|
||||
};
|
||||
|
||||
ATTRIBUTE_ALIGNED16(struct) btConstraintInfo2 {
|
||||
struct btConstraintInfo2 {
|
||||
// integrator parameters: frames per second (1/stepsize), default error
|
||||
// reduction parameter (0..1).
|
||||
btScalar fps,erp;
|
||||
|
||||
@@ -110,16 +110,16 @@ void plDeleteDynamicsWorld(plDynamicsWorldHandle world)
|
||||
void plStepSimulation(plDynamicsWorldHandle world, plReal timeStep)
|
||||
{
|
||||
btDynamicsWorld* dynamicsWorld = reinterpret_cast< btDynamicsWorld* >(world);
|
||||
assert(dynamicsWorld);
|
||||
btAssert(dynamicsWorld);
|
||||
dynamicsWorld->stepSimulation(timeStep);
|
||||
}
|
||||
|
||||
void plAddRigidBody(plDynamicsWorldHandle world, plRigidBodyHandle object)
|
||||
{
|
||||
btDynamicsWorld* dynamicsWorld = reinterpret_cast< btDynamicsWorld* >(world);
|
||||
assert(dynamicsWorld);
|
||||
btAssert(dynamicsWorld);
|
||||
btRigidBody* body = reinterpret_cast< btRigidBody* >(object);
|
||||
assert(body);
|
||||
btAssert(body);
|
||||
|
||||
dynamicsWorld->addRigidBody(body);
|
||||
}
|
||||
@@ -127,9 +127,9 @@ void plAddRigidBody(plDynamicsWorldHandle world, plRigidBodyHandle object)
|
||||
void plRemoveRigidBody(plDynamicsWorldHandle world, plRigidBodyHandle object)
|
||||
{
|
||||
btDynamicsWorld* dynamicsWorld = reinterpret_cast< btDynamicsWorld* >(world);
|
||||
assert(dynamicsWorld);
|
||||
btAssert(dynamicsWorld);
|
||||
btRigidBody* body = reinterpret_cast< btRigidBody* >(object);
|
||||
assert(body);
|
||||
btAssert(body);
|
||||
|
||||
dynamicsWorld->removeRigidBody(body);
|
||||
}
|
||||
@@ -142,7 +142,7 @@ plRigidBodyHandle plCreateRigidBody( void* user_data, float mass, plCollisionSh
|
||||
trans.setIdentity();
|
||||
btVector3 localInertia(0,0,0);
|
||||
btCollisionShape* shape = reinterpret_cast<btCollisionShape*>( cshape);
|
||||
assert(shape);
|
||||
btAssert(shape);
|
||||
if (mass)
|
||||
{
|
||||
shape->calculateLocalInertia(mass,localInertia);
|
||||
@@ -158,7 +158,7 @@ plRigidBodyHandle plCreateRigidBody( void* user_data, float mass, plCollisionSh
|
||||
void plDeleteRigidBody(plRigidBodyHandle cbody)
|
||||
{
|
||||
btRigidBody* body = reinterpret_cast< btRigidBody* >(cbody);
|
||||
assert(body);
|
||||
btAssert(body);
|
||||
btAlignedFree( body);
|
||||
}
|
||||
|
||||
@@ -262,13 +262,13 @@ void plAddVertex(plCollisionShapeHandle cshape, plReal x,plReal y,plReal z)
|
||||
void plDeleteShape(plCollisionShapeHandle cshape)
|
||||
{
|
||||
btCollisionShape* shape = reinterpret_cast<btCollisionShape*>( cshape);
|
||||
assert(shape);
|
||||
btAssert(shape);
|
||||
btAlignedFree(shape);
|
||||
}
|
||||
void plSetScaling(plCollisionShapeHandle cshape, plVector3 cscaling)
|
||||
{
|
||||
btCollisionShape* shape = reinterpret_cast<btCollisionShape*>( cshape);
|
||||
assert(shape);
|
||||
btAssert(shape);
|
||||
btVector3 scaling(cscaling[0],cscaling[1],cscaling[2]);
|
||||
shape->setLocalScaling(scaling);
|
||||
}
|
||||
|
||||
@@ -712,7 +712,7 @@ void btDiscreteDynamicsWorld::solveConstraints(btContactSolverInfo& solverInfo)
|
||||
sortedConstraints[i] = m_constraints[i];
|
||||
}
|
||||
|
||||
// assert(0);
|
||||
// btAssert(0);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ btWheelInfo& btRaycastVehicle::addWheel( const btVector3& connectionPointCS, con
|
||||
|
||||
const btTransform& btRaycastVehicle::getWheelTransformWS( int wheelIndex ) const
|
||||
{
|
||||
assert(wheelIndex < getNumWheels());
|
||||
btAssert(wheelIndex < getNumWheels());
|
||||
const btWheelInfo& wheel = m_wheelInfo[wheelIndex];
|
||||
return wheel.m_worldTransform;
|
||||
|
||||
@@ -175,7 +175,7 @@ btScalar btRaycastVehicle::rayCast(btWheelInfo& wheel)
|
||||
|
||||
btVehicleRaycaster::btVehicleRaycasterResult rayResults;
|
||||
|
||||
assert(m_vehicleRaycaster);
|
||||
btAssert(m_vehicleRaycaster);
|
||||
|
||||
void* object = m_vehicleRaycaster->castRay(source,target,rayResults);
|
||||
|
||||
@@ -359,7 +359,7 @@ void btRaycastVehicle::updateVehicle( btScalar step )
|
||||
|
||||
void btRaycastVehicle::setSteeringValue(btScalar steering,int wheel)
|
||||
{
|
||||
assert(wheel>=0 && wheel < getNumWheels());
|
||||
btAssert(wheel>=0 && wheel < getNumWheels());
|
||||
|
||||
btWheelInfo& wheelInfo = getWheelInfo(wheel);
|
||||
wheelInfo.m_steering = steering;
|
||||
@@ -375,7 +375,7 @@ btScalar btRaycastVehicle::getSteeringValue(int wheel) const
|
||||
|
||||
void btRaycastVehicle::applyEngineForce(btScalar force, int wheel)
|
||||
{
|
||||
assert(wheel>=0 && wheel < getNumWheels());
|
||||
btAssert(wheel>=0 && wheel < getNumWheels());
|
||||
btWheelInfo& wheelInfo = getWheelInfo(wheel);
|
||||
wheelInfo.m_engineForce = force;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ void SpuCollisionTaskProcess::initialize2(bool useEpa)
|
||||
|
||||
#ifdef DEBUG_SpuCollisionTaskProcess
|
||||
m_initialized = true;
|
||||
assert(MIDPHASE_NUM_WORKUNITS_PER_TASK*sizeof(SpuGatherAndProcessWorkUnitInput) <= MIDPHASE_WORKUNIT_TASK_SIZE);
|
||||
btAssert(MIDPHASE_NUM_WORKUNITS_PER_TASK*sizeof(SpuGatherAndProcessWorkUnitInput) <= MIDPHASE_WORKUNIT_TASK_SIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -173,8 +173,8 @@ void SpuCollisionTaskProcess::addWorkToTask(void* pairArrayPtr,int startIndex,in
|
||||
#endif //DEBUG_SPU_TASK_SCHEDULING
|
||||
|
||||
#ifdef DEBUG_SpuCollisionTaskProcess
|
||||
assert(m_initialized);
|
||||
assert(m_workUnitTaskBuffers);
|
||||
btAssert(m_initialized);
|
||||
btAssert(m_workUnitTaskBuffers);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ subject to the following restrictions:
|
||||
|
||||
|
||||
#include "SpuVoronoiSimplexSolver.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define VERTA 0
|
||||
@@ -37,7 +36,7 @@ subject to the following restrictions:
|
||||
void SpuVoronoiSimplexSolver::removeVertex(int index)
|
||||
{
|
||||
|
||||
assert(m_numVertices>0);
|
||||
btAssert(m_numVertices>0);
|
||||
m_numVertices--;
|
||||
m_simplexVectorW[index] = m_simplexVectorW[m_numVertices];
|
||||
m_simplexPointsP[index] = m_simplexPointsP[m_numVertices];
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
void setRotation(const btVector3& axis, const btScalar& angle)
|
||||
{
|
||||
btScalar d = axis.length();
|
||||
assert(d != btScalar(0.0));
|
||||
btAssert(d != btScalar(0.0));
|
||||
btScalar s = btSin(angle * btScalar(0.5)) / d;
|
||||
setValue(axis.x() * s, axis.y() * s, axis.z() * s,
|
||||
btCos(angle * btScalar(0.5)));
|
||||
@@ -177,7 +177,7 @@ public:
|
||||
* @param s The inverse scale factor */
|
||||
btQuaternion operator/(const btScalar& s) const
|
||||
{
|
||||
assert(s != btScalar(0.0));
|
||||
btAssert(s != btScalar(0.0));
|
||||
return *this * (btScalar(1.0) / s);
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ public:
|
||||
* @param s The scale factor */
|
||||
btQuaternion& operator/=(const btScalar& s)
|
||||
{
|
||||
assert(s != btScalar(0.0));
|
||||
btAssert(s != btScalar(0.0));
|
||||
return *this *= btScalar(1.0) / s;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
btScalar angle(const btQuaternion& q) const
|
||||
{
|
||||
btScalar s = btSqrt(length2() * q.length2());
|
||||
assert(s != btScalar(0.0));
|
||||
btAssert(s != btScalar(0.0));
|
||||
return btAcos(dot(q) / s);
|
||||
}
|
||||
/**@brief Return the angle of rotation represented by this quaternion */
|
||||
|
||||
@@ -130,8 +130,11 @@ inline int btGetVersion()
|
||||
//non-windows systems
|
||||
|
||||
#define SIMD_FORCE_INLINE inline
|
||||
#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16)))
|
||||
#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128)))
|
||||
///@todo: check out alignment methods for other platforms/compilers
|
||||
///#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16)))
|
||||
///#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128)))
|
||||
#define ATTRIBUTE_ALIGNED16(a) a
|
||||
#define ATTRIBUTE_ALIGNED128(a) a
|
||||
#ifndef assert
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user