fix bug in the OPC_ArraySAP.cpp (used in Extras/CDTestFramework to compare agains Bullet broadphases)
Thanks to Olli-Pekka Räsänen for the report, mentioned by Pierre Terdiman in his blog: http://www.codercorner.com/blog/?p=475
This commit is contained in:
@@ -399,6 +399,9 @@ void ASAP_PairManager::ReallocPairs()
|
||||
void* mObject;
|
||||
udword mGUID;
|
||||
|
||||
inline_ void SetInvalid() { mMin[0]=INVALID_INDEX; }
|
||||
inline_ bool IsValid() const { return mMin[0]!=INVALID_INDEX; }
|
||||
|
||||
inline_ ValType GetMaxValue(udword i, const ASAP_EndPoint* base) const
|
||||
{
|
||||
return base[mMax[i]].mValue;
|
||||
@@ -836,27 +839,29 @@ void ArraySAP::BatchCreate()
|
||||
udword i=0;
|
||||
while(i<NbOldBoxes)
|
||||
{
|
||||
while(BA.IsSet(Offset))
|
||||
|
||||
|
||||
if(!BA.IsSet(i))
|
||||
{
|
||||
Offset++;
|
||||
assert(Offset<mNbBoxes);
|
||||
const ASAP_Box* Box = mBoxes + i;
|
||||
// if(Box->mObject)
|
||||
if(Box->IsValid())
|
||||
{
|
||||
OldBoxesIndices[Offset] = i;
|
||||
|
||||
OldBoxes[Offset].mMinX = Box->mMin[0];
|
||||
OldBoxes[Offset].mMaxX = Box->mMax[0];
|
||||
OldBoxes[Offset].mMinY = Box->mMin[1];
|
||||
OldBoxes[Offset].mMaxY = Box->mMax[1];
|
||||
OldBoxes[Offset].mMinZ = Box->mMin[2];
|
||||
OldBoxes[Offset].mMaxZ = Box->mMax[2];
|
||||
Offset++;
|
||||
}
|
||||
}
|
||||
|
||||
const ASAP_Box* Box = mBoxes + Offset;
|
||||
OldBoxesIndices[i] = Offset;
|
||||
|
||||
OldBoxes[i].mMinX = Box->mMin[0];
|
||||
OldBoxes[i].mMaxX = Box->mMax[0];
|
||||
OldBoxes[i].mMinY = Box->mMin[1];
|
||||
OldBoxes[i].mMaxY = Box->mMax[1];
|
||||
OldBoxes[i].mMinZ = Box->mMin[2];
|
||||
OldBoxes[i].mMaxZ = Box->mMax[2];
|
||||
Offset++;
|
||||
i++;
|
||||
}
|
||||
assert(i==NbOldBoxes);
|
||||
|
||||
BipartiteBoxPruning2(NbBatched, NewBoxes, NbOldBoxes, OldBoxes, Axes(AXES_XZY), Batched, OldBoxesIndices);
|
||||
// assert(i==NbOldBoxes);
|
||||
BipartiteBoxPruning2(NbBatched, NewBoxes, Offset, OldBoxes, Axes(AXES_XZY), Batched, OldBoxesIndices);
|
||||
|
||||
ICE_FREE(OldBoxesIndices);
|
||||
DELETEARRAY(OldBoxes);
|
||||
@@ -937,6 +942,8 @@ void ArraySAP::BatchRemove()
|
||||
BA.SetBit(Object->mGUID);
|
||||
|
||||
Object->mGUID = mFirstFree;
|
||||
// Object->mObject = null; // ###########
|
||||
Object->SetInvalid();
|
||||
mFirstFree = Index;
|
||||
}
|
||||
mNbBoxes -= Saved;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
Version="9.00"
|
||||
Name="Opcode"
|
||||
ProjectGUID="{DBE44CA3-2912-4441-8D99-AA2242688AD2}"
|
||||
RootNamespace="Opcode"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
@@ -55,7 +56,7 @@
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OPCODE_EXPORTS"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="0"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
@@ -149,7 +150,7 @@
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;OPCODE_EXPORTS"
|
||||
ExceptionHandling="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile=".\Debug/Opcode.pch"
|
||||
|
||||
Reference in New Issue
Block a user