-Divide speed by 10 for more useful results as recommended by Pierre Terdiman.
-Using shared speed value.
This commit is contained in:
@@ -341,7 +341,6 @@ BulletSAPCompleteBoxPruningTest::BulletSAPCompleteBoxPruningTest(int numBoxes,in
|
|||||||
mBoxes (null),
|
mBoxes (null),
|
||||||
mBoxPtrs (null),
|
mBoxPtrs (null),
|
||||||
mBoxTime (null),
|
mBoxTime (null),
|
||||||
mSpeed (0.005f),
|
|
||||||
mAmplitude (100.0f),
|
mAmplitude (100.0f),
|
||||||
m_method(method)
|
m_method(method)
|
||||||
{
|
{
|
||||||
@@ -473,15 +472,34 @@ void BulletSAPCompleteBoxPruningTest::Release()
|
|||||||
DELETEARRAY(mBoxes);
|
DELETEARRAY(mBoxes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int doTree;
|
||||||
|
extern int percentUpdate;
|
||||||
|
extern float objectSpeed;
|
||||||
|
|
||||||
|
static void TW_CALL NormalMode(void* pdata)
|
||||||
|
{
|
||||||
|
btDbvtBroadphase* pb=(btDbvtBroadphase*)pdata;
|
||||||
|
pb->m_deferedcollide = true;
|
||||||
|
pb->m_predictedframes = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void TW_CALL SlowSpeedMode(void* pdata)
|
||||||
|
{
|
||||||
|
btDbvtBroadphase* pb=(btDbvtBroadphase*)pdata;
|
||||||
|
pb->m_deferedcollide = false;
|
||||||
|
pb->m_predictedframes = 15;
|
||||||
|
}
|
||||||
|
|
||||||
void BulletSAPCompleteBoxPruningTest::Select()
|
void BulletSAPCompleteBoxPruningTest::Select()
|
||||||
{
|
{
|
||||||
// Create a tweak bar
|
// Create a tweak bar
|
||||||
{
|
{
|
||||||
mBar = TwNewBar("OPC_CompleteBoxPruning");
|
mBar = TwNewBar("OPC_CompleteBoxPruning");
|
||||||
TwAddVarRW(mBar, "Speed", TW_TYPE_FLOAT, &mSpeed, " min=0.0 max=0.01 step=0.00001");
|
TwAddVarRW(mBar, "Speed", TW_TYPE_FLOAT, &objectSpeed, " min=0.0 max=0.01 step=0.0001");
|
||||||
TwAddVarRW(mBar, "Amplitude", TW_TYPE_FLOAT, &mAmplitude, " min=10.0 max=200.0 step=0.1");
|
TwAddVarRW(mBar, "Amplitude", TW_TYPE_FLOAT, &mAmplitude, " min=10.0 max=200.0 step=0.1");
|
||||||
if(m_isdbvt)
|
if(m_isdbvt)
|
||||||
{
|
{
|
||||||
|
btDbvtBroadphase* pbp=(btDbvtBroadphase*)m_broadphase;
|
||||||
TwAddVarRW(mBar, "Enable culling",TW_TYPE_BOOLCPP,&enableCulling,"");
|
TwAddVarRW(mBar, "Enable culling",TW_TYPE_BOOLCPP,&enableCulling,"");
|
||||||
TwAddVarRW(mBar, "Enable occlusion",TW_TYPE_BOOLCPP,&enableOcclusion,"");
|
TwAddVarRW(mBar, "Enable occlusion",TW_TYPE_BOOLCPP,&enableOcclusion,"");
|
||||||
TwAddVarRW(mBar, "Show culling",TW_TYPE_BOOLCPP,&showCulling,"");
|
TwAddVarRW(mBar, "Show culling",TW_TYPE_BOOLCPP,&showCulling,"");
|
||||||
@@ -489,13 +507,19 @@ void BulletSAPCompleteBoxPruningTest::Select()
|
|||||||
TwAddVarRW(mBar, "Cull far plane",TW_TYPE_BOOLCPP,&cullFarPlane,"");
|
TwAddVarRW(mBar, "Cull far plane",TW_TYPE_BOOLCPP,&cullFarPlane,"");
|
||||||
TwAddVarRW(mBar, "OC Min area",TW_TYPE_FLOAT,&ocb.ocarea,"min=0.0 max=1.0 step=0.001");
|
TwAddVarRW(mBar, "OC Min area",TW_TYPE_FLOAT,&ocb.ocarea,"min=0.0 max=1.0 step=0.001");
|
||||||
TwAddVarRW(mBar, "QR Min area",TW_TYPE_FLOAT,&ocb.qrarea,"min=0.0 max=1.0 step=0.001");
|
TwAddVarRW(mBar, "QR Min area",TW_TYPE_FLOAT,&ocb.qrarea,"min=0.0 max=1.0 step=0.001");
|
||||||
TwAddVarRW(mBar, "Dyn lkhd",TW_TYPE_INT32,&((btDbvtBroadphase*)m_broadphase)->m_sets[0].m_lkhd,"min=-1 max=32");
|
TwAddVarRW(mBar, "Dyn lkhd",TW_TYPE_INT32,&pbp->m_sets[0].m_lkhd,"min=-1 max=32");
|
||||||
TwAddVarRW(mBar, "Fix lkhd",TW_TYPE_INT32,&((btDbvtBroadphase*)m_broadphase)->m_sets[1].m_lkhd,"min=-1 max=32");
|
TwAddVarRW(mBar, "Fix lkhd",TW_TYPE_INT32,&pbp->m_sets[1].m_lkhd,"min=-1 max=32");
|
||||||
TwAddVarRW(mBar, "Dyn opt/f(%)",TW_TYPE_INT32,&((btDbvtBroadphase*)m_broadphase)->m_dupdates,"min=0 max=100");
|
TwAddVarRW(mBar, "Dyn opt/f(%)",TW_TYPE_INT32,&pbp->m_dupdates,"min=0 max=100");
|
||||||
TwAddVarRW(mBar, "Fix opt/f(%)",TW_TYPE_INT32,&((btDbvtBroadphase*)m_broadphase)->m_fupdates,"min=0 max=100");
|
TwAddVarRW(mBar, "Fix opt/f(%)",TW_TYPE_INT32,&pbp->m_fupdates,"min=0 max=100");
|
||||||
TwAddVarRO(mBar, "Dyn leafs",TW_TYPE_INT32,&((btDbvtBroadphase*)m_broadphase)->m_sets[0].m_leaves,"");
|
TwAddVarRW(mBar, "Cln opt/f(%)",TW_TYPE_INT32,&pbp->m_cupdates,"min=0 max=100");
|
||||||
TwAddVarRO(mBar, "Fix leafs",TW_TYPE_INT32,&((btDbvtBroadphase*)m_broadphase)->m_sets[1].m_leaves,"");
|
TwAddVarRW(mBar, "Pred.frames",TW_TYPE_FLOAT,&pbp->m_predictedframes,"min=0.0 max=50.0 step=0.5");
|
||||||
TwAddVarRO(mBar, "Visible",TW_TYPE_INT32,&visiblecount,"");
|
TwAddVarRW(mBar, "Defered collide",TW_TYPE_BOOLCPP,&pbp->m_deferedcollide,"");
|
||||||
|
TwAddVarRO(mBar, "Dyn leafs",TW_TYPE_INT32,&pbp->m_sets[0].m_leaves,"");
|
||||||
|
TwAddVarRO(mBar, "Fix leafs",TW_TYPE_INT32,&pbp->m_sets[1].m_leaves,"");
|
||||||
|
TwAddVarRO(mBar, "Updates ratio",TW_TYPE_FLOAT,&pbp->m_updates_ratio,"");
|
||||||
|
TwAddVarRO(mBar, "Visible",TW_TYPE_INT32,&visiblecount,"");
|
||||||
|
TwAddButton(mBar,"Normal mode",&NormalMode,m_broadphase,"");
|
||||||
|
TwAddButton(mBar,"Slow speed mode",&SlowSpeedMode,m_broadphase,"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("SubMethod: %s\r\n",methodname);
|
printf("SubMethod: %s\r\n",methodname);
|
||||||
@@ -516,7 +540,7 @@ bool BulletSAPCompleteBoxPruningTest::UpdateBoxes(int numBoxes)
|
|||||||
|
|
||||||
for(udword i=0;i<(udword)numBoxes;i++)
|
for(udword i=0;i<(udword)numBoxes;i++)
|
||||||
{
|
{
|
||||||
mBoxTime[i] += mSpeed;
|
mBoxTime[i] += objectSpeed;
|
||||||
|
|
||||||
Point Center,Extents;
|
Point Center,Extents;
|
||||||
mBoxes[i].GetExtents(Extents);
|
mBoxes[i].GetExtents(Extents);
|
||||||
@@ -529,8 +553,6 @@ bool BulletSAPCompleteBoxPruningTest::UpdateBoxes(int numBoxes)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
extern int doTree;
|
|
||||||
extern int percentUpdate;
|
|
||||||
|
|
||||||
void BulletSAPCompleteBoxPruningTest::PerformTest()
|
void BulletSAPCompleteBoxPruningTest::PerformTest()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ subject to the following restrictions:
|
|||||||
const AABB** mBoxPtrs;
|
const AABB** mBoxPtrs;
|
||||||
Pairs mPairs;
|
Pairs mPairs;
|
||||||
float* mBoxTime;
|
float* mBoxTime;
|
||||||
float mSpeed;
|
|
||||||
float mAmplitude;
|
float mAmplitude;
|
||||||
bool m_firstTime;
|
bool m_firstTime;
|
||||||
int m_method;
|
int m_method;
|
||||||
|
|||||||
@@ -21,17 +21,21 @@ subject to the following restrictions:
|
|||||||
#include "CapsuleMeshQuery.h"
|
#include "CapsuleMeshQuery.h"
|
||||||
#include "CompleteBoxPruning.h"
|
#include "CompleteBoxPruning.h"
|
||||||
#include "BulletSAPCompleteBoxPruningTest.h"
|
#include "BulletSAPCompleteBoxPruningTest.h"
|
||||||
|
#include "BulletSAPCompleteBoxPruningTest.h"
|
||||||
#include "BipartiteBoxPruning.h"
|
#include "BipartiteBoxPruning.h"
|
||||||
#include "OpcodeArraySAPTest.h"
|
#include "OpcodeArraySAPTest.h"
|
||||||
#include "RenderingHelpers.h"
|
#include "RenderingHelpers.h"
|
||||||
#include "Terrain.h"
|
#include "Terrain.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "GLFontRenderer.h"
|
#include "GLFontRenderer.h"
|
||||||
|
#include "BulletCollision/BroadphaseCollision/btDbvtBroadphase.h"
|
||||||
|
|
||||||
#define NUM_SAP_BOXES 8192
|
#define NUM_SAP_BOXES 8192
|
||||||
//#define NUM_SAP_BOXES 1024
|
//#define NUM_SAP_BOXES 1024
|
||||||
|
|
||||||
int percentUpdate = 10;
|
int percentUpdate = 10;
|
||||||
|
//float objectSpeed = 0.005f;
|
||||||
|
float objectSpeed = 0.0005f;
|
||||||
|
|
||||||
//Broadphase comparison
|
//Broadphase comparison
|
||||||
//Static case (updating 10% of objects to same position ( -> no swaps)
|
//Static case (updating 10% of objects to same position ( -> no swaps)
|
||||||
@@ -227,6 +231,11 @@ static void Terminate()
|
|||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
::SetPriorityClass(::GetCurrentProcess(),REALTIME_PRIORITY_CLASS);
|
||||||
|
/*btDbvt::benchmark();
|
||||||
|
exit(0);*/
|
||||||
|
}
|
||||||
// Initialize AntTweakBar
|
// Initialize AntTweakBar
|
||||||
// (note that AntTweakBar could also be intialize after GLUT, no matter)
|
// (note that AntTweakBar could also be intialize after GLUT, no matter)
|
||||||
if(!TwInit(TW_OPENGL, NULL))
|
if(!TwInit(TW_OPENGL, NULL))
|
||||||
@@ -300,7 +309,7 @@ int main(int argc, char** argv)
|
|||||||
};
|
};
|
||||||
TwType testType = TwDefineEnum("CollisionTest", testEV, MAX_NB_TESTS);
|
TwType testType = TwDefineEnum("CollisionTest", testEV, MAX_NB_TESTS);
|
||||||
TwAddVarRW(gMainBar, "CollisionTests", testType, &gSelectedTest, "");
|
TwAddVarRW(gMainBar, "CollisionTests", testType, &gSelectedTest, "");
|
||||||
TwAddVarRW(gMainBar, "% of updates",TW_TYPE_INT32,&percentUpdate,"min=0 max=100");
|
TwAddVarRW(gMainBar, "% of updates",TW_TYPE_INT32,&percentUpdate,"min=0 max=100");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create tests
|
// Create tests
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ OpcodeArraySAPTest::OpcodeArraySAPTest(int numBoxes) :
|
|||||||
mBoxes (null),
|
mBoxes (null),
|
||||||
mHandles (null),
|
mHandles (null),
|
||||||
mBoxTime (null),
|
mBoxTime (null),
|
||||||
mSpeed (0.005f),
|
|
||||||
mAmplitude (100.0f)
|
mAmplitude (100.0f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -101,12 +100,14 @@ void OpcodeArraySAPTest::Release()
|
|||||||
DELETEARRAY(mBoxes);
|
DELETEARRAY(mBoxes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern float objectSpeed;
|
||||||
|
|
||||||
void OpcodeArraySAPTest::Select()
|
void OpcodeArraySAPTest::Select()
|
||||||
{
|
{
|
||||||
// Create a tweak bar
|
// Create a tweak bar
|
||||||
{
|
{
|
||||||
mBar = TwNewBar("OpcodeArraySAPTest");
|
mBar = TwNewBar("OpcodeArraySAPTest");
|
||||||
TwAddVarRW(mBar, "Speed", TW_TYPE_FLOAT, &mSpeed, " min=0.0 max=0.01 step=0.00001");
|
TwAddVarRW(mBar, "Speed", TW_TYPE_FLOAT, &objectSpeed, " min=0.0 max=0.01 step=0.00001");
|
||||||
TwAddVarRW(mBar, "Amplitude", TW_TYPE_FLOAT, &mAmplitude, " min=10.0 max=200.0 step=0.1");
|
TwAddVarRW(mBar, "Amplitude", TW_TYPE_FLOAT, &mAmplitude, " min=10.0 max=200.0 step=0.1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,7 +125,7 @@ bool OpcodeArraySAPTest::UpdateBoxes(int numBoxes)
|
|||||||
{
|
{
|
||||||
for(int i=0;i<numBoxes;i++)
|
for(int i=0;i<numBoxes;i++)
|
||||||
{
|
{
|
||||||
mBoxTime[i] += mSpeed;
|
mBoxTime[i] += objectSpeed;
|
||||||
|
|
||||||
Point Center,Extents;
|
Point Center,Extents;
|
||||||
mBoxes[i].GetExtents(Extents);
|
mBoxes[i].GetExtents(Extents);
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ subject to the following restrictions:
|
|||||||
AABB* mBoxes;
|
AABB* mBoxes;
|
||||||
void** mHandles;
|
void** mHandles;
|
||||||
float* mBoxTime;
|
float* mBoxTime;
|
||||||
float mSpeed;
|
|
||||||
float mAmplitude;
|
float mAmplitude;
|
||||||
bool m_firstTime;
|
bool m_firstTime;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user