fixed growing of hash table, to avoid hard limit on overlapping pairs
This commit is contained in:
@@ -31,7 +31,7 @@ btOverlappingPairCache::btOverlappingPairCache():
|
|||||||
m_blockedForChanges(false),
|
m_blockedForChanges(false),
|
||||||
m_overlapFilterCallback(0)
|
m_overlapFilterCallback(0)
|
||||||
{
|
{
|
||||||
int initialAllocatedSize= 65536*256;//2;//this needs to be a power of 2!
|
int initialAllocatedSize= 2;
|
||||||
m_overlappingPairArray.reserve(initialAllocatedSize);
|
m_overlappingPairArray.reserve(initialAllocatedSize);
|
||||||
|
|
||||||
growTables();
|
growTables();
|
||||||
@@ -157,7 +157,6 @@ btBroadphasePair* btOverlappingPairCache::findPair(btBroadphaseProxy* proxy0, bt
|
|||||||
|
|
||||||
void btOverlappingPairCache::growTables()
|
void btOverlappingPairCache::growTables()
|
||||||
{
|
{
|
||||||
//or put an assert here instead?
|
|
||||||
|
|
||||||
int newCapacity = m_overlappingPairArray.capacity();
|
int newCapacity = m_overlappingPairArray.capacity();
|
||||||
|
|
||||||
@@ -170,20 +169,17 @@ void btOverlappingPairCache::growTables()
|
|||||||
m_hashTable.resize(newCapacity);
|
m_hashTable.resize(newCapacity);
|
||||||
m_next.resize(newCapacity);
|
m_next.resize(newCapacity);
|
||||||
|
|
||||||
for (int i= curHashtableSize; i < newCapacity; ++i)
|
for (int i= 0; i < newCapacity; ++i)
|
||||||
{
|
{
|
||||||
m_hashTable[i] = BT_NULL_PAIR;
|
m_hashTable[i] = BT_NULL_PAIR;
|
||||||
}
|
}
|
||||||
for (int i = curNextTableSize; i < newCapacity; ++i)
|
for (int i = 0; i < newCapacity; ++i)
|
||||||
{
|
{
|
||||||
m_next[i] = BT_NULL_PAIR;
|
m_next[i] = BT_NULL_PAIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0;i<curHashtableSize;i++)
|
for(int i=0;i<curHashtableSize;i++)
|
||||||
{
|
{
|
||||||
btAssert(0);
|
|
||||||
//this is not working yet, work in progress... please allocate enough room up front to avoid growing for now.
|
|
||||||
|
|
||||||
|
|
||||||
const btBroadphasePair& pair = m_overlappingPairArray[i];
|
const btBroadphasePair& pair = m_overlappingPairArray[i];
|
||||||
int proxyId1 = pair.m_pProxy0->getUid();
|
int proxyId1 = pair.m_pProxy0->getUid();
|
||||||
|
|||||||
Reference in New Issue
Block a user