More stable parameters for solver (GpuDemo2d)

Added a possibility to switch between GPU/Bullet narrowphase ('j' key)
This commit is contained in:
rponom
2009-05-12 01:54:41 +00:00
parent 34685cb631
commit fcf7bda3b0
4 changed files with 34 additions and 8 deletions

View File

@@ -97,6 +97,7 @@ bool gUseCPUSolver = false;
bool gUseCPUSolver = true;
#endif //BT_USE_CUDA
bool gUseBulletNarrowphase = false;
#include "oecakeLoader.h"
@@ -303,6 +304,8 @@ void BasicDemo::initPhysics()
pDdw->setWorldMax(gWorldMax);
// gUseCPUSolver = true;
pDdw->setUseCPUSolver(gUseCPUSolver);
gUseBulletNarrowphase = false;
pDdw->setUseBulletNarrowphase(gUseBulletNarrowphase);
// m_dynamicsWorld->setGravity(btVector3(0,0,0));
m_dynamicsWorld->setGravity(btVector3(0,-10.,0));
@@ -586,6 +589,21 @@ void BasicDemo::keyboardCallback(unsigned char key, int x, int y)
pDdw->setUseCPUSolver(gUseCPUSolver);
break;
}
case 'j' :
{
btGpuDemoDynamicsWorld* pDdw = (btGpuDemoDynamicsWorld*)m_dynamicsWorld;
gUseBulletNarrowphase = !gUseBulletNarrowphase;
pDdw->setUseBulletNarrowphase(gUseBulletNarrowphase);
if(gUseBulletNarrowphase)
{
m_dispatcher->setNearCallback(btCollisionDispatcher::defaultNearCallback);
}
else
{
m_dispatcher->setNearCallback(cudaDemoNearCallback);
}
break;
}
default :
{
DemoApplication::keyboardCallback(key, x, y);