revert some testing code in BasicDemo
This commit is contained in:
@@ -13,27 +13,17 @@ subject to the following restrictions:
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LARGE_DEMO 0
|
|
||||||
|
|
||||||
#if LARGE_DEMO
|
|
||||||
///create 512 (8x8x8) dynamic object
|
|
||||||
#define ARRAY_SIZE_X 8
|
|
||||||
#define ARRAY_SIZE_Y 8
|
|
||||||
#define ARRAY_SIZE_Z 8
|
|
||||||
#else
|
|
||||||
///create 125 (5x5x5) dynamic object
|
|
||||||
#define ARRAY_SIZE_X 5
|
|
||||||
#define ARRAY_SIZE_Y 5
|
|
||||||
#define ARRAY_SIZE_Z 5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
///create 125 (5x5x5) dynamic object
|
||||||
|
#define ARRAY_SIZE_X 5
|
||||||
|
#define ARRAY_SIZE_Y 5
|
||||||
|
#define ARRAY_SIZE_Z 5
|
||||||
|
|
||||||
//maximum number of objects (and allow user to shoot additional boxes)
|
//maximum number of objects (and allow user to shoot additional boxes)
|
||||||
#define MAX_PROXIES (ARRAY_SIZE_X*ARRAY_SIZE_Y*ARRAY_SIZE_Z + 1024)
|
#define MAX_PROXIES (ARRAY_SIZE_X*ARRAY_SIZE_Y*ARRAY_SIZE_Z + 1024)
|
||||||
|
|
||||||
///scaling of the objects (0.1 = 20 centimeter boxes )
|
///scaling of the objects (0.1 = 20 centimeter boxes )
|
||||||
//#define SCALING 0.1
|
#define SCALING 0.1
|
||||||
#define SCALING 1
|
|
||||||
#define START_POS_X -5
|
#define START_POS_X -5
|
||||||
#define START_POS_Y -5
|
#define START_POS_Y -5
|
||||||
#define START_POS_Z -3
|
#define START_POS_Z -3
|
||||||
@@ -44,9 +34,6 @@ subject to the following restrictions:
|
|||||||
#include "btBulletDynamicsCommon.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
#include <stdio.h> //printf debugging
|
#include <stdio.h> //printf debugging
|
||||||
|
|
||||||
#include "BulletDynamics/ConstraintSolver/btParallelBatchConstraintSolver.h"
|
|
||||||
#include "BulletDynamics/ConstraintSolver/btParallelBatchConstraintSolver2.h"
|
|
||||||
#include "BulletCollision/CollisionDispatch/btSimulationIslandManager.h"
|
|
||||||
|
|
||||||
void BasicDemo::clientMoveAndDisplay()
|
void BasicDemo::clientMoveAndDisplay()
|
||||||
{
|
{
|
||||||
@@ -59,10 +46,6 @@ void BasicDemo::clientMoveAndDisplay()
|
|||||||
if (m_dynamicsWorld)
|
if (m_dynamicsWorld)
|
||||||
{
|
{
|
||||||
m_dynamicsWorld->stepSimulation(ms / 1000000.f);
|
m_dynamicsWorld->stepSimulation(ms / 1000000.f);
|
||||||
if (m_idle)
|
|
||||||
{
|
|
||||||
CProfileManager::dumpAll();
|
|
||||||
}
|
|
||||||
//optional but useful: debug drawing
|
//optional but useful: debug drawing
|
||||||
m_dynamicsWorld->debugDrawWorld();
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
}
|
}
|
||||||
@@ -92,10 +75,6 @@ void BasicDemo::displayCallback(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static btSequentialImpulseConstraintSolver* sDefSeqImpSolver = 0;
|
|
||||||
static btParallelBatchConstraintSolver* sParallelBatchSolver = 0;
|
|
||||||
static btParallelBatchConstraintSolver2* sParallelBatchSolver2 = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -115,31 +94,22 @@ void BasicDemo::initPhysics()
|
|||||||
m_broadphase = new btDbvtBroadphase();
|
m_broadphase = new btDbvtBroadphase();
|
||||||
|
|
||||||
///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
|
///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
|
||||||
sDefSeqImpSolver = new btSequentialImpulseConstraintSolver;
|
btSequentialImpulseConstraintSolver* sol = new btSequentialImpulseConstraintSolver;
|
||||||
// create parallel batch solver for tests
|
m_solver = sol;
|
||||||
sParallelBatchSolver = new btParallelBatchConstraintSolver();
|
|
||||||
sParallelBatchSolver2 = new btParallelBatchConstraintSolver2();
|
|
||||||
|
|
||||||
// start with parallel batch solver
|
|
||||||
m_solver = sParallelBatchSolver;
|
|
||||||
|
|
||||||
btDiscreteDynamicsWorld* ddw = new btDiscreteDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
|
m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
|
||||||
m_dynamicsWorld = ddw;
|
|
||||||
ddw->getSimulationIslandManager()->setSplitIslands(false);
|
|
||||||
|
|
||||||
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
|
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
|
||||||
|
|
||||||
///create a few basic rigid bodies
|
///create a few basic rigid bodies
|
||||||
btCollisionShape* groundShape = new btBoxShape(btVector3(btScalar(30.),btScalar(1.),btScalar(30.)));
|
btCollisionShape* groundShape = new btBoxShape(btVector3(btScalar(50.),btScalar(50.),btScalar(50.)));
|
||||||
// btCollisionShape* groundShape = new btBoxShape(btVector3(btScalar(50.),btScalar(50.),btScalar(50.)));
|
|
||||||
// btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),50);
|
// btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),50);
|
||||||
|
|
||||||
m_collisionShapes.push_back(groundShape);
|
m_collisionShapes.push_back(groundShape);
|
||||||
|
|
||||||
btTransform groundTransform;
|
btTransform groundTransform;
|
||||||
groundTransform.setIdentity();
|
groundTransform.setIdentity();
|
||||||
groundTransform.setOrigin(btVector3(0,-5,0));
|
groundTransform.setOrigin(btVector3(0,-50,0));
|
||||||
// groundTransform.setOrigin(btVector3(0,-50,0));
|
|
||||||
|
|
||||||
//We can also use DemoApplication::localCreateRigidBody, but for clarity it is provided here:
|
//We can also use DemoApplication::localCreateRigidBody, but for clarity it is provided here:
|
||||||
{
|
{
|
||||||
@@ -245,9 +215,7 @@ void BasicDemo::exitPhysics()
|
|||||||
|
|
||||||
delete m_dynamicsWorld;
|
delete m_dynamicsWorld;
|
||||||
|
|
||||||
m_solver = 0;
|
delete m_solver;
|
||||||
delete sDefSeqImpSolver;
|
|
||||||
delete sParallelBatchSolver;
|
|
||||||
|
|
||||||
delete m_broadphase;
|
delete m_broadphase;
|
||||||
|
|
||||||
@@ -260,48 +228,4 @@ void BasicDemo::exitPhysics()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void BasicDemo::keyboardCallback(unsigned char key, int x, int y)
|
|
||||||
{
|
|
||||||
(void)x;
|
|
||||||
(void)y;
|
|
||||||
switch (key)
|
|
||||||
{
|
|
||||||
case 'q' :
|
|
||||||
exitPhysics();
|
|
||||||
break;
|
|
||||||
case 'S' :
|
|
||||||
{
|
|
||||||
btConstraintSolver* curr_solver = m_dynamicsWorld->getConstraintSolver();
|
|
||||||
btDiscreteDynamicsWorld* pDdw = (btDiscreteDynamicsWorld*)m_dynamicsWorld;
|
|
||||||
if(curr_solver == sDefSeqImpSolver)
|
|
||||||
{
|
|
||||||
static bool toggle = true;
|
|
||||||
toggle=!toggle;
|
|
||||||
if (toggle)
|
|
||||||
{
|
|
||||||
pDdw->setConstraintSolver(sParallelBatchSolver);
|
|
||||||
pDdw->getSimulationIslandManager()->setSplitIslands(false);
|
|
||||||
printf("\nUsing ParallelBatch constraint solver\n");
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
pDdw->setConstraintSolver(sParallelBatchSolver2);
|
|
||||||
pDdw->getSimulationIslandManager()->setSplitIslands(false);
|
|
||||||
printf("\nUsing ParallelBatch constraint solver2\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_dynamicsWorld->setConstraintSolver(sDefSeqImpSolver);
|
|
||||||
pDdw->getSimulationIslandManager()->setSplitIslands(true);
|
|
||||||
printf("\nUsing default SequentialImpulse constraint solver\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
DemoApplication::keyboardCallback(key, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ class BasicDemo : public DemoApplication
|
|||||||
virtual void clientMoveAndDisplay();
|
virtual void clientMoveAndDisplay();
|
||||||
|
|
||||||
virtual void displayCallback();
|
virtual void displayCallback();
|
||||||
|
|
||||||
virtual void keyboardCallback(unsigned char key, int x, int y);
|
|
||||||
|
|
||||||
static DemoApplication* Create()
|
static DemoApplication* Create()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user