Refactoring: another huge number of changes, renamed methods to start with lower-case.

This commit is contained in:
ejcoumans
2006-09-28 01:11:16 +00:00
parent d0f09040e9
commit 2b1657b1dd
185 changed files with 2103 additions and 2095 deletions

View File

@@ -21,25 +21,25 @@
#include <assert.h>
btBroadphaseProxy* btAxisSweep3::CreateProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask)
btBroadphaseProxy* btAxisSweep3::createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask)
{
unsigned short handleId = AddHandle(min,max, userPtr,collisionFilterGroup,collisionFilterMask);
unsigned short handleId = addHandle(min,max, userPtr,collisionFilterGroup,collisionFilterMask);
Handle* handle = GetHandle(handleId);
Handle* handle = getHandle(handleId);
return handle;
}
void btAxisSweep3::DestroyProxy(btBroadphaseProxy* proxy)
void btAxisSweep3::destroyProxy(btBroadphaseProxy* proxy)
{
Handle* handle = static_cast<Handle*>(proxy);
RemoveHandle(handle->m_handleId);
removeHandle(handle->m_handleId);
}
void btAxisSweep3::SetAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)
void btAxisSweep3::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)
{
Handle* handle = static_cast<Handle*>(proxy);
UpdateHandle(handle->m_handleId,aabbMin,aabbMax);
updateHandle(handle->m_handleId,aabbMin,aabbMax);
}
@@ -107,7 +107,7 @@ btAxisSweep3::~btAxisSweep3()
delete[] m_pHandles;
}
void btAxisSweep3::Quantize(unsigned short* out, const btPoint3& point, int isMax) const
void btAxisSweep3::quantize(unsigned short* out, const btPoint3& point, int isMax) const
{
btPoint3 clampedPoint(point);
/*
@@ -132,22 +132,22 @@ void btAxisSweep3::Quantize(unsigned short* out, const btPoint3& point, int isMa
unsigned short btAxisSweep3::AllocHandle()
unsigned short btAxisSweep3::allocHandle()
{
assert(m_firstFreeHandle);
unsigned short handle = m_firstFreeHandle;
m_firstFreeHandle = GetHandle(handle)->GetNextFree();
m_firstFreeHandle = getHandle(handle)->GetNextFree();
m_numHandles++;
return handle;
}
void btAxisSweep3::FreeHandle(unsigned short handle)
void btAxisSweep3::freeHandle(unsigned short handle)
{
assert(handle > 0 && handle < m_maxHandles);
GetHandle(handle)->SetNextFree(m_firstFreeHandle);
getHandle(handle)->SetNextFree(m_firstFreeHandle);
m_firstFreeHandle = handle;
m_numHandles--;
@@ -155,18 +155,18 @@ void btAxisSweep3::FreeHandle(unsigned short handle)
unsigned short btAxisSweep3::AddHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask)
unsigned short btAxisSweep3::addHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask)
{
// quantize the bounds
unsigned short min[3], max[3];
Quantize(min, aabbMin, 0);
Quantize(max, aabbMax, 1);
quantize(min, aabbMin, 0);
quantize(max, aabbMax, 1);
// allocate a handle
unsigned short handle = AllocHandle();
unsigned short handle = allocHandle();
assert(handle!= 0xcdcd);
Handle* pHandle = GetHandle(handle);
Handle* pHandle = getHandle(handle);
pHandle->m_handleId = handle;
//pHandle->m_pOverlaps = 0;
@@ -195,12 +195,12 @@ unsigned short btAxisSweep3::AddHandle(const btPoint3& aabbMin,const btPoint3& a
}
// now sort the new edges to their correct position
SortMinDown(0, pHandle->m_minEdges[0], false);
SortMaxDown(0, pHandle->m_maxEdges[0], false);
SortMinDown(1, pHandle->m_minEdges[1], false);
SortMaxDown(1, pHandle->m_maxEdges[1], false);
SortMinDown(2, pHandle->m_minEdges[2], true);
SortMaxDown(2, pHandle->m_maxEdges[2], true);
sortMinDown(0, pHandle->m_minEdges[0], false);
sortMaxDown(0, pHandle->m_maxEdges[0], false);
sortMinDown(1, pHandle->m_minEdges[1], false);
sortMaxDown(1, pHandle->m_maxEdges[1], false);
sortMinDown(2, pHandle->m_minEdges[2], true);
sortMaxDown(2, pHandle->m_maxEdges[2], true);
//PrintAxis(1);
@@ -208,14 +208,14 @@ unsigned short btAxisSweep3::AddHandle(const btPoint3& aabbMin,const btPoint3& a
}
void btAxisSweep3::RemoveHandle(unsigned short handle)
void btAxisSweep3::removeHandle(unsigned short handle)
{
Handle* pHandle = GetHandle(handle);
Handle* pHandle = getHandle(handle);
//explicitly remove the pairs containing the proxy
//we could do it also in the SortMinUp (passing true)
//we could do it also in the sortMinUp (passing true)
//todo: compare performance
RemoveOverlappingPairsContainingProxy(pHandle);
removeOverlappingPairsContainingProxy(pHandle);
// compute current limit of edge arrays
@@ -238,12 +238,12 @@ void btAxisSweep3::RemoveHandle(unsigned short handle)
int max = pHandle->m_maxEdges[axis];
pEdges[max].m_pos = 0xffff;
SortMaxUp(axis,max,false);
sortMaxUp(axis,max,false);
int i = pHandle->m_minEdges[axis];
pEdges[i].m_pos = 0xffff;
SortMinUp(axis,i,false);
sortMinUp(axis,i,false);
pEdges[limit-1].m_handle = 0;
pEdges[limit-1].m_pos = 0xffff;
@@ -251,12 +251,12 @@ void btAxisSweep3::RemoveHandle(unsigned short handle)
}
// free the handle
FreeHandle(handle);
freeHandle(handle);
}
bool btAxisSweep3::TestOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB)
bool btAxisSweep3::testOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB)
{
//optimization 1: check the array index (memory address), instead of the m_pos
@@ -287,17 +287,17 @@ bool btAxisSweep3::TestOverlap(int ignoreAxis,const Handle* pHandleA, const Hand
return true;
}
void btAxisSweep3::UpdateHandle(unsigned short handle, const btPoint3& aabbMin,const btPoint3& aabbMax)
void btAxisSweep3::updateHandle(unsigned short handle, const btPoint3& aabbMin,const btPoint3& aabbMax)
{
// assert(bounds.IsFinite());
//assert(bounds.HasVolume());
Handle* pHandle = GetHandle(handle);
Handle* pHandle = getHandle(handle);
// quantize the new bounds
unsigned short min[3], max[3];
Quantize(min, aabbMin, 0);
Quantize(max, aabbMax, 1);
quantize(min, aabbMin, 0);
quantize(max, aabbMax, 1);
// update changed edges
for (int axis = 0; axis < 3; axis++)
@@ -313,39 +313,39 @@ void btAxisSweep3::UpdateHandle(unsigned short handle, const btPoint3& aabbMin,c
// expand (only adds overlaps)
if (dmin < 0)
SortMinDown(axis, emin);
sortMinDown(axis, emin);
if (dmax > 0)
SortMaxUp(axis, emax);
sortMaxUp(axis, emax);
// shrink (only removes overlaps)
if (dmin > 0)
SortMinUp(axis, emin);
sortMinUp(axis, emin);
if (dmax < 0)
SortMaxDown(axis, emax);
sortMaxDown(axis, emax);
}
//PrintAxis(1);
}
// sorting a min edge downwards can only ever *add* overlaps
void btAxisSweep3::SortMinDown(int axis, unsigned short edge, bool updateOverlaps)
void btAxisSweep3::sortMinDown(int axis, unsigned short edge, bool updateOverlaps)
{
Edge* pEdge = m_pEdges[axis] + edge;
Edge* pPrev = pEdge - 1;
Handle* pHandleEdge = GetHandle(pEdge->m_handle);
Handle* pHandleEdge = getHandle(pEdge->m_handle);
while (pEdge->m_pos < pPrev->m_pos)
{
Handle* pHandlePrev = GetHandle(pPrev->m_handle);
Handle* pHandlePrev = getHandle(pPrev->m_handle);
if (pPrev->IsMax())
{
// if previous edge is a maximum check the bounds and add an overlap if necessary
if (updateOverlaps && TestOverlap(axis,pHandleEdge, pHandlePrev))
if (updateOverlaps && testOverlap(axis,pHandleEdge, pHandlePrev))
{
AddOverlappingPair(pHandleEdge,pHandlePrev);
addOverlappingPair(pHandleEdge,pHandlePrev);
//AddOverlap(pEdge->m_handle, pPrev->m_handle);
@@ -371,25 +371,25 @@ void btAxisSweep3::SortMinDown(int axis, unsigned short edge, bool updateOverlap
}
// sorting a min edge upwards can only ever *remove* overlaps
void btAxisSweep3::SortMinUp(int axis, unsigned short edge, bool updateOverlaps)
void btAxisSweep3::sortMinUp(int axis, unsigned short edge, bool updateOverlaps)
{
Edge* pEdge = m_pEdges[axis] + edge;
Edge* pNext = pEdge + 1;
Handle* pHandleEdge = GetHandle(pEdge->m_handle);
Handle* pHandleEdge = getHandle(pEdge->m_handle);
while (pEdge->m_pos > pNext->m_pos)
{
Handle* pHandleNext = GetHandle(pNext->m_handle);
Handle* pHandleNext = getHandle(pNext->m_handle);
if (pNext->IsMax())
{
// if next edge is maximum remove any overlap between the two handles
if (updateOverlaps)
{
Handle* handle0 = GetHandle(pEdge->m_handle);
Handle* handle1 = GetHandle(pNext->m_handle);
Handle* handle0 = getHandle(pEdge->m_handle);
Handle* handle1 = getHandle(pNext->m_handle);
btBroadphasePair tmpPair(*handle0,*handle1);
RemoveOverlappingPair(tmpPair);
removeOverlappingPair(tmpPair);
}
@@ -413,29 +413,29 @@ void btAxisSweep3::SortMinUp(int axis, unsigned short edge, bool updateOverlaps)
}
// sorting a max edge downwards can only ever *remove* overlaps
void btAxisSweep3::SortMaxDown(int axis, unsigned short edge, bool updateOverlaps)
void btAxisSweep3::sortMaxDown(int axis, unsigned short edge, bool updateOverlaps)
{
Edge* pEdge = m_pEdges[axis] + edge;
Edge* pPrev = pEdge - 1;
Handle* pHandleEdge = GetHandle(pEdge->m_handle);
Handle* pHandleEdge = getHandle(pEdge->m_handle);
while (pEdge->m_pos < pPrev->m_pos)
{
Handle* pHandlePrev = GetHandle(pPrev->m_handle);
Handle* pHandlePrev = getHandle(pPrev->m_handle);
if (!pPrev->IsMax())
{
// if previous edge was a minimum remove any overlap between the two handles
if (updateOverlaps)
{
Handle* handle0 = GetHandle(pEdge->m_handle);
Handle* handle1 = GetHandle(pPrev->m_handle);
btBroadphasePair* pair = FindPair(handle0,handle1);
Handle* handle0 = getHandle(pEdge->m_handle);
Handle* handle1 = getHandle(pPrev->m_handle);
btBroadphasePair* pair = findPair(handle0,handle1);
//assert(pair);
if (pair)
{
RemoveOverlappingPair(*pair);
removeOverlappingPair(*pair);
}
}
@@ -459,24 +459,24 @@ void btAxisSweep3::SortMaxDown(int axis, unsigned short edge, bool updateOverlap
}
// sorting a max edge upwards can only ever *add* overlaps
void btAxisSweep3::SortMaxUp(int axis, unsigned short edge, bool updateOverlaps)
void btAxisSweep3::sortMaxUp(int axis, unsigned short edge, bool updateOverlaps)
{
Edge* pEdge = m_pEdges[axis] + edge;
Edge* pNext = pEdge + 1;
Handle* pHandleEdge = GetHandle(pEdge->m_handle);
Handle* pHandleEdge = getHandle(pEdge->m_handle);
while (pEdge->m_pos > pNext->m_pos)
{
Handle* pHandleNext = GetHandle(pNext->m_handle);
Handle* pHandleNext = getHandle(pNext->m_handle);
if (!pNext->IsMax())
{
// if next edge is a minimum check the bounds and add an overlap if necessary
if (updateOverlaps && TestOverlap(axis, pHandleEdge, pHandleNext))
if (updateOverlaps && testOverlap(axis, pHandleEdge, pHandleNext))
{
Handle* handle0 = GetHandle(pEdge->m_handle);
Handle* handle1 = GetHandle(pNext->m_handle);
AddOverlappingPair(handle0,handle1);
Handle* handle0 = getHandle(pEdge->m_handle);
Handle* handle1 = getHandle(pNext->m_handle);
addOverlappingPair(handle0,handle1);
}
// update edge reference in other handle

View File

@@ -26,7 +26,7 @@
/// btAxisSweep3 is an efficient implementation of the 3d axis sweep and prune broadphase.
/// It uses arrays rather then lists for storage of the 3 axis. Also it operates using integer coordinates instead of floats.
/// The TestOverlap check is optimized to check the array index, rather then the actual AABB coordinates/pos
/// The testOverlap check is optimized to check the array index, rather then the actual AABB coordinates/pos
class btAxisSweep3 : public btOverlappingPairCache
{
@@ -74,41 +74,41 @@ private:
// allocation/deallocation
unsigned short AllocHandle();
void FreeHandle(unsigned short handle);
unsigned short allocHandle();
void freeHandle(unsigned short handle);
bool TestOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB);
bool testOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB);
//Overlap* AddOverlap(unsigned short handleA, unsigned short handleB);
//void RemoveOverlap(unsigned short handleA, unsigned short handleB);
void Quantize(unsigned short* out, const btPoint3& point, int isMax) const;
void quantize(unsigned short* out, const btPoint3& point, int isMax) const;
void SortMinDown(int axis, unsigned short edge, bool updateOverlaps = true);
void SortMinUp(int axis, unsigned short edge, bool updateOverlaps = true);
void SortMaxDown(int axis, unsigned short edge, bool updateOverlaps = true);
void SortMaxUp(int axis, unsigned short edge, bool updateOverlaps = true);
void sortMinDown(int axis, unsigned short edge, bool updateOverlaps = true);
void sortMinUp(int axis, unsigned short edge, bool updateOverlaps = true);
void sortMaxDown(int axis, unsigned short edge, bool updateOverlaps = true);
void sortMaxUp(int axis, unsigned short edge, bool updateOverlaps = true);
public:
btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, int maxHandles = 16384);
virtual ~btAxisSweep3();
virtual void RefreshOverlappingPairs()
virtual void refreshOverlappingPairs()
{
//this is replace by sweep and prune
}
unsigned short AddHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask);
void RemoveHandle(unsigned short handle);
void UpdateHandle(unsigned short handle, const btPoint3& aabbMin,const btPoint3& aabbMax);
inline Handle* GetHandle(unsigned short index) const {return m_pHandles + index;}
unsigned short addHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask);
void removeHandle(unsigned short handle);
void updateHandle(unsigned short handle, const btPoint3& aabbMin,const btPoint3& aabbMax);
inline Handle* getHandle(unsigned short index) const {return m_pHandles + index;}
//Broadphase Interface
virtual btBroadphaseProxy* CreateProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask);
virtual void DestroyProxy(btBroadphaseProxy* proxy);
virtual void SetAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax);
virtual btBroadphaseProxy* createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask);
virtual void destroyProxy(btBroadphaseProxy* proxy);
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax);
};

View File

@@ -29,10 +29,10 @@ class btBroadphaseInterface
public:
virtual ~btBroadphaseInterface() {}
virtual btBroadphaseProxy* CreateProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask) =0;
virtual void DestroyProxy(btBroadphaseProxy* proxy)=0;
virtual void SetAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)=0;
virtual void CleanProxyFromPairs(btBroadphaseProxy* proxy)=0;
virtual btBroadphaseProxy* createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask) =0;
virtual void destroyProxy(btBroadphaseProxy* proxy)=0;
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)=0;
virtual void cleanProxyFromPairs(btBroadphaseProxy* proxy)=0;
};

View File

@@ -74,22 +74,22 @@ struct btBroadphaseProxy
{
}
static inline bool IsPolyhedral(int proxyType)
static inline bool isPolyhedral(int proxyType)
{
return (proxyType < IMPLICIT_CONVEX_SHAPES_START_HERE);
}
static inline bool IsConvex(int proxyType)
static inline bool isConvex(int proxyType)
{
return (proxyType < CONCAVE_SHAPES_START_HERE);
}
static inline bool IsConcave(int proxyType)
static inline bool isConcave(int proxyType)
{
return ((proxyType > CONCAVE_SHAPES_START_HERE) &&
(proxyType < CONCAVE_SHAPES_END_HERE));
}
static inline bool IsCompound(int proxyType)
static inline bool isCompound(int proxyType)
{
return (proxyType == COMPOUND_SHAPE_PROXYTYPE);
}

View File

@@ -32,7 +32,7 @@ struct btCollisionAlgorithmConstructionInfo
btDispatcher* m_dispatcher;
int GetDispatcherId();
int getDispatcherId();
};
@@ -47,7 +47,7 @@ protected:
btDispatcher* m_dispatcher;
protected:
int GetDispatcherId();
int getDispatcherId();
public:
@@ -57,9 +57,9 @@ public:
virtual ~btCollisionAlgorithm() {};
virtual void ProcessCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const struct btDispatcherInfo& dispatchInfo) = 0;
virtual void processCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const struct btDispatcherInfo& dispatchInfo) = 0;
virtual float CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const struct btDispatcherInfo& dispatchInfo) = 0;
virtual float calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const struct btDispatcherInfo& dispatchInfo) = 0;
};

View File

@@ -66,32 +66,32 @@ class btDispatcher
public:
virtual ~btDispatcher() ;
virtual btCollisionAlgorithm* FindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1) = 0;
virtual btCollisionAlgorithm* findAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1) = 0;
//
// asume dispatchers to have unique id's in the range [0..max dispacher]
//
virtual int GetUniqueId() = 0;
virtual int getUniqueId() = 0;
virtual btPersistentManifold* GetNewManifold(void* body0,void* body1)=0;
virtual btPersistentManifold* getNewManifold(void* body0,void* body1)=0;
virtual void ReleaseManifold(btPersistentManifold* manifold)=0;
virtual void releaseManifold(btPersistentManifold* manifold)=0;
virtual void ClearManifold(btPersistentManifold* manifold)=0;
virtual void clearManifold(btPersistentManifold* manifold)=0;
virtual bool NeedsCollision(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1) = 0;
virtual bool needsCollision(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1) = 0;
virtual bool NeedsResponse(const btCollisionObject& colObj0,const btCollisionObject& colObj1)=0;
virtual bool needsResponse(const btCollisionObject& colObj0,const btCollisionObject& colObj1)=0;
virtual btManifoldResult* GetNewManifoldResult(btCollisionObject* obj0,btCollisionObject* obj1,btPersistentManifold* manifold) =0;
virtual btManifoldResult* getNewManifoldResult(btCollisionObject* obj0,btCollisionObject* obj1,btPersistentManifold* manifold) =0;
virtual void ReleaseManifoldResult(btManifoldResult*)=0;
virtual void releaseManifoldResult(btManifoldResult*)=0;
virtual void DispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo)=0;
virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo)=0;
virtual int GetNumManifolds() const = 0;
virtual int getNumManifolds() const = 0;
virtual btPersistentManifold* GetManifoldByIndexInternal(int index) = 0;
virtual btPersistentManifold* getManifoldByIndexInternal(int index) = 0;
};

View File

@@ -36,7 +36,7 @@ btOverlappingPairCache::~btOverlappingPairCache()
}
void btOverlappingPairCache::RemoveOverlappingPair(btBroadphasePair& findPair)
void btOverlappingPairCache::removeOverlappingPair(btBroadphasePair& findPair)
{
std::set<btBroadphasePair>::iterator it = m_overlappingPairSet.find(findPair);
@@ -46,13 +46,13 @@ void btOverlappingPairCache::RemoveOverlappingPair(btBroadphasePair& findPair)
{
gOverlappingPairs--;
btBroadphasePair* pair = (btBroadphasePair*)(&(*it));
CleanOverlappingPair(*pair);
cleanOverlappingPair(*pair);
m_overlappingPairSet.erase(it);
}
}
void btOverlappingPairCache::CleanOverlappingPair(btBroadphasePair& pair)
void btOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair)
{
for (int dispatcherId=0;dispatcherId<SIMPLE_MAX_ALGORITHMS;dispatcherId++)
{
@@ -70,12 +70,12 @@ void btOverlappingPairCache::CleanOverlappingPair(btBroadphasePair& pair)
void btOverlappingPairCache::AddOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
void btOverlappingPairCache::addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
//don't add overlap with own
assert(proxy0 != proxy1);
if (!NeedsCollision(proxy0,proxy1))
if (!needsCollision(proxy0,proxy1))
return;
@@ -86,13 +86,13 @@ void btOverlappingPairCache::AddOverlappingPair(btBroadphaseProxy* proxy0,btBroa
}
///this FindPair becomes really slow. Either sort the list to speedup the query, or
///this findPair becomes really slow. Either sort the list to speedup the query, or
///use a different solution. It is mainly used for Removing overlapping pairs. Removal could be delayed.
///we could keep a linked list in each proxy, and store pair in one of the proxies (with lowest memory address)
///Also we can use a 2D bitmap, which can be useful for a future GPU implementation
btBroadphasePair* btOverlappingPairCache::FindPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
btBroadphasePair* btOverlappingPairCache::findPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
if (!NeedsCollision(proxy0,proxy1))
if (!needsCollision(proxy0,proxy1))
return 0;
btBroadphasePair tmpPair(*proxy0,*proxy1);
@@ -109,7 +109,7 @@ void btOverlappingPairCache::AddOverlappingPair(btBroadphaseProxy* proxy0,btBroa
void btOverlappingPairCache::CleanProxyFromPairs(btBroadphaseProxy* proxy)
void btOverlappingPairCache::cleanProxyFromPairs(btBroadphaseProxy* proxy)
{
class CleanPairCallback : public btOverlapCallback
@@ -123,12 +123,12 @@ void btOverlappingPairCache::CleanProxyFromPairs(btBroadphaseProxy* proxy)
m_pairCache(pairCache)
{
}
virtual bool ProcessOverlap(btBroadphasePair& pair)
virtual bool processOverlap(btBroadphasePair& pair)
{
if ((pair.m_pProxy0 == m_cleanProxy) ||
(pair.m_pProxy1 == m_cleanProxy))
{
m_pairCache->CleanOverlappingPair(pair);
m_pairCache->cleanOverlappingPair(pair);
}
return false;
}
@@ -137,13 +137,13 @@ void btOverlappingPairCache::CleanProxyFromPairs(btBroadphaseProxy* proxy)
CleanPairCallback cleanPairs(proxy,this);
ProcessAllOverlappingPairs(&cleanPairs);
processAllOverlappingPairs(&cleanPairs);
}
void btOverlappingPairCache::RemoveOverlappingPairsContainingProxy(btBroadphaseProxy* proxy)
void btOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy)
{
class RemovePairCallback : public btOverlapCallback
@@ -155,7 +155,7 @@ void btOverlappingPairCache::RemoveOverlappingPairsContainingProxy(btBroadphaseP
:m_obsoleteProxy(obsoleteProxy)
{
}
virtual bool ProcessOverlap(btBroadphasePair& pair)
virtual bool processOverlap(btBroadphasePair& pair)
{
return ((pair.m_pProxy0 == m_obsoleteProxy) ||
(pair.m_pProxy1 == m_obsoleteProxy));
@@ -166,21 +166,21 @@ void btOverlappingPairCache::RemoveOverlappingPairsContainingProxy(btBroadphaseP
RemovePairCallback removeCallback(proxy);
ProcessAllOverlappingPairs(&removeCallback);
processAllOverlappingPairs(&removeCallback);
}
void btOverlappingPairCache::ProcessAllOverlappingPairs(btOverlapCallback* callback)
void btOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callback)
{
std::set<btBroadphasePair>::iterator it = m_overlappingPairSet.begin();
for (; !(it==m_overlappingPairSet.end());)
{
btBroadphasePair* pair = (btBroadphasePair*)(&(*it));
if (callback->ProcessOverlap(*pair))
if (callback->processOverlap(*pair))
{
CleanOverlappingPair(*pair);
cleanOverlappingPair(*pair);
std::set<btBroadphasePair>::iterator it2 = it;
//why does next line not compile under OS X??

View File

@@ -30,7 +30,7 @@ virtual ~btOverlapCallback()
{
}
//return true for deletion of the pair
virtual bool ProcessOverlap(btBroadphasePair& pair) = 0;
virtual bool processOverlap(btBroadphasePair& pair) = 0;
};
///OverlappingPairCache maintains the objects with overlapping AABB
@@ -48,23 +48,23 @@ class btOverlappingPairCache : public btBroadphaseInterface
btOverlappingPairCache();
virtual ~btOverlappingPairCache();
void ProcessAllOverlappingPairs(btOverlapCallback*);
void processAllOverlappingPairs(btOverlapCallback*);
void RemoveOverlappingPair(btBroadphasePair& pair);
void removeOverlappingPair(btBroadphasePair& pair);
void CleanOverlappingPair(btBroadphasePair& pair);
void cleanOverlappingPair(btBroadphasePair& pair);
void AddOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
void addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
btBroadphasePair* FindPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
btBroadphasePair* findPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
void CleanProxyFromPairs(btBroadphaseProxy* proxy);
void cleanProxyFromPairs(btBroadphaseProxy* proxy);
void RemoveOverlappingPairsContainingProxy(btBroadphaseProxy* proxy);
void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy);
inline bool NeedsCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const
inline bool needsCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const
{
bool collides = proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask;
collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask);
@@ -74,7 +74,7 @@ class btOverlappingPairCache : public btBroadphaseInterface
virtual void RefreshOverlappingPairs() =0;
virtual void refreshOverlappingPairs() =0;

View File

@@ -70,7 +70,7 @@ btSimpleBroadphase::~btSimpleBroadphase()
}
btBroadphaseProxy* btSimpleBroadphase::CreateProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask)
btBroadphaseProxy* btSimpleBroadphase::createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask)
{
if (m_numProxies >= m_maxProxies)
{
@@ -98,7 +98,7 @@ btBroadphaseProxy* btSimpleBroadphase::CreateProxy( const btVector3& min, cons
class RemovingOverlapCallback : public btOverlapCallback
{
protected:
virtual bool ProcessOverlap(btBroadphasePair& pair)
virtual bool processOverlap(btBroadphasePair& pair)
{
assert(0);
}
@@ -113,7 +113,7 @@ class RemovePairContainingProxy
{
}
protected:
virtual bool ProcessOverlap(btBroadphasePair& pair)
virtual bool processOverlap(btBroadphasePair& pair)
{
btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy0);
btSimpleBroadphaseProxy* proxy1 = static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy1);
@@ -122,7 +122,7 @@ protected:
};
};
void btSimpleBroadphase::DestroyProxy(btBroadphaseProxy* proxyOrg)
void btSimpleBroadphase::destroyProxy(btBroadphaseProxy* proxyOrg)
{
int i;
@@ -134,7 +134,7 @@ void btSimpleBroadphase::DestroyProxy(btBroadphaseProxy* proxyOrg)
assert (index < m_maxProxies);
m_freeProxies[--m_firstFreeProxy] = index;
//RemoveOverlappingPairsContainingProxy(proxyOrg);
//removeOverlappingPairsContainingProxy(proxyOrg);
assert(0);
//then remove non-overlapping ones
@@ -142,11 +142,11 @@ void btSimpleBroadphase::DestroyProxy(btBroadphaseProxy* proxyOrg)
{
btBroadphasePair& pair = GetOverlappingPair(i);
btSimpleBroadphaseProxy* proxy0 = GetSimpleProxyFromProxy(pair.m_pProxy0);
btSimpleBroadphaseProxy* proxy1 = GetSimpleProxyFromProxy(pair.m_pProxy1);
btSimpleBroadphaseProxy* proxy0 = getSimpleProxyFromProxy(pair.m_pProxy0);
btSimpleBroadphaseProxy* proxy1 = getSimpleProxyFromProxy(pair.m_pProxy1);
if ((proxy0==proxyOrg) || (proxy1==proxyOrg))
{
RemoveOverlappingPair(pair);
removeOverlappingPair(pair);
}
}
*/
@@ -167,9 +167,9 @@ void btSimpleBroadphase::DestroyProxy(btBroadphaseProxy* proxyOrg)
}
void btSimpleBroadphase::SetAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)
void btSimpleBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)
{
btSimpleBroadphaseProxy* sbp = GetSimpleProxyFromProxy(proxy);
btSimpleBroadphaseProxy* sbp = getSimpleProxyFromProxy(proxy);
sbp->m_min = aabbMin;
sbp->m_max = aabbMax;
}
@@ -182,7 +182,7 @@ void btSimpleBroadphase::SetAabb(btBroadphaseProxy* proxy,const btVector3& aabbM
bool btSimpleBroadphase::AabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1)
bool btSimpleBroadphase::aabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1)
{
return proxy0->m_min[0] <= proxy1->m_max[0] && proxy1->m_min[0] <= proxy0->m_max[0] &&
proxy0->m_min[1] <= proxy1->m_max[1] && proxy1->m_min[1] <= proxy0->m_max[1] &&
@@ -196,13 +196,13 @@ bool btSimpleBroadphase::AabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBro
class CheckOverlapCallback : public btOverlapCallback
{
public:
virtual bool ProcessOverlap(btBroadphasePair& pair)
virtual bool processOverlap(btBroadphasePair& pair)
{
return (!btSimpleBroadphase::AabbOverlap(static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy0),static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy1)));
return (!btSimpleBroadphase::aabbOverlap(static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy0),static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy1)));
}
};
void btSimpleBroadphase::RefreshOverlappingPairs()
void btSimpleBroadphase::refreshOverlappingPairs()
{
//first check for new overlapping pairs
int i,j;
@@ -213,14 +213,14 @@ void btSimpleBroadphase::RefreshOverlappingPairs()
for (j=i+1;j<m_numProxies;j++)
{
btBroadphaseProxy* proxy1 = m_pProxies[j];
btSimpleBroadphaseProxy* p0 = GetSimpleProxyFromProxy(proxy0);
btSimpleBroadphaseProxy* p1 = GetSimpleProxyFromProxy(proxy1);
btSimpleBroadphaseProxy* p0 = getSimpleProxyFromProxy(proxy0);
btSimpleBroadphaseProxy* p1 = getSimpleProxyFromProxy(proxy1);
if (AabbOverlap(p0,p1))
if (aabbOverlap(p0,p1))
{
if ( !FindPair(proxy0,proxy1))
if ( !findPair(proxy0,proxy1))
{
AddOverlappingPair(proxy0,proxy1);
addOverlappingPair(proxy0,proxy1);
}
}
@@ -230,7 +230,7 @@ void btSimpleBroadphase::RefreshOverlappingPairs()
CheckOverlapCallback checkOverlap;
ProcessAllOverlappingPairs(&checkOverlap);
processAllOverlappingPairs(&checkOverlap);
}

View File

@@ -52,7 +52,7 @@ class btSimpleBroadphase : public btOverlappingPairCache
int m_maxProxies;
inline btSimpleBroadphaseProxy* GetSimpleProxyFromProxy(btBroadphaseProxy* proxy)
inline btSimpleBroadphaseProxy* getSimpleProxyFromProxy(btBroadphaseProxy* proxy)
{
btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadphaseProxy*>(proxy);
return proxy0;
@@ -64,20 +64,20 @@ class btSimpleBroadphase : public btOverlappingPairCache
protected:
virtual void RefreshOverlappingPairs();
virtual void refreshOverlappingPairs();
public:
btSimpleBroadphase(int maxProxies=16384);
virtual ~btSimpleBroadphase();
static bool AabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1);
static bool aabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1);
virtual btBroadphaseProxy* CreateProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask);
virtual btBroadphaseProxy* createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask);
virtual void DestroyProxy(btBroadphaseProxy* proxy);
virtual void SetAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax);
virtual void destroyProxy(btBroadphaseProxy* proxy);
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax);