more work on IBM Cell SDK 3.1 build
This commit is contained in:
@@ -15,8 +15,7 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
|
|
||||||
//#define USE_GROUND_BOX 1
|
//#define USE_GROUND_BOX 1
|
||||||
//#define PRINT_CONTACT_STATISTICS 1
|
#define PRINT_CONTACT_STATISTICS 1
|
||||||
//#define CHECK_MEMORY_LEAKS 1
|
|
||||||
#define USE_PARALLEL_DISPATCHER 1
|
#define USE_PARALLEL_DISPATCHER 1
|
||||||
|
|
||||||
|
|
||||||
@@ -27,19 +26,16 @@ int gNumObjects = 120;
|
|||||||
#include "btBulletDynamicsCommon.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
#include "BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h"
|
#include "BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h"
|
||||||
#include "LinearMath/btIDebugDraw.h"
|
#include "LinearMath/btIDebugDraw.h"
|
||||||
#include "GLDebugDrawer.h"
|
|
||||||
#include <stdio.h> //printf debugging
|
#include <stdio.h> //printf debugging
|
||||||
btScalar deltaTime = btScalar(1./60.);
|
btScalar deltaTime = btScalar(1./60.);
|
||||||
btScalar gCollisionMargin = btScalar(0.05);
|
btScalar gCollisionMargin = btScalar(0.05);
|
||||||
#include "BasicDemo2.h"
|
#include "BasicDemo2.h"
|
||||||
#include "GL_ShapeDrawer.h"
|
|
||||||
#include "GlutStuff.h"
|
|
||||||
|
|
||||||
#ifdef USE_PARALLEL_DISPATCHER
|
#ifdef USE_PARALLEL_DISPATCHER
|
||||||
#include "../../Extras/BulletMultiThreaded/SpuGatheringCollisionDispatcher.h"
|
#include "BulletMultiThreaded/SpuGatheringCollisionDispatcher.h"
|
||||||
#include "../../Extras/BulletMultiThreaded/Win32ThreadSupport.h"
|
#include "BulletMultiThreaded/Win32ThreadSupport.h"
|
||||||
#include "../../Extras/BulletMultiThreaded/SpuLibspe2Support.h"
|
#include "BulletMultiThreaded/SpuLibspe2Support.h"
|
||||||
#include "../../Extras/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h"
|
#include "BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h"
|
||||||
#endif//USE_PARALLEL_DISPATCHER
|
#endif//USE_PARALLEL_DISPATCHER
|
||||||
|
|
||||||
|
|
||||||
@@ -47,12 +43,6 @@ btScalar gCollisionMargin = btScalar(0.05);
|
|||||||
|
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
|
|
||||||
GLDebugDrawer debugDrawer;
|
|
||||||
|
|
||||||
class myTest
|
|
||||||
{
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -61,15 +51,12 @@ int main(int argc,char** argv)
|
|||||||
|
|
||||||
BasicDemo ccdDemo;
|
BasicDemo ccdDemo;
|
||||||
ccdDemo.initPhysics();
|
ccdDemo.initPhysics();
|
||||||
ccdDemo.setCameraDistance(btScalar(50.));
|
|
||||||
|
|
||||||
#ifdef CHECK_MEMORY_LEAKS
|
int i;
|
||||||
|
for (i=0;i<1000;i++)
|
||||||
|
ccdDemo.clientMoveAndDisplay();
|
||||||
ccdDemo.exitPhysics();
|
ccdDemo.exitPhysics();
|
||||||
#else
|
|
||||||
return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",&ccdDemo);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//default glut doesn't return from mainloop
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +68,6 @@ extern int gTotalContactPoints;
|
|||||||
|
|
||||||
void BasicDemo::clientMoveAndDisplay()
|
void BasicDemo::clientMoveAndDisplay()
|
||||||
{
|
{
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
||||||
|
|
||||||
//simple dynamics world doesn't handle fixed-time-stepping
|
//simple dynamics world doesn't handle fixed-time-stepping
|
||||||
float ms = m_clock.getTimeMicroseconds();
|
float ms = m_clock.getTimeMicroseconds();
|
||||||
@@ -93,9 +79,6 @@ void BasicDemo::clientMoveAndDisplay()
|
|||||||
if (m_dynamicsWorld)
|
if (m_dynamicsWorld)
|
||||||
m_dynamicsWorld->stepSimulation(ms / 1000000.f);
|
m_dynamicsWorld->stepSimulation(ms / 1000000.f);
|
||||||
|
|
||||||
renderme();
|
|
||||||
|
|
||||||
glFlush();
|
|
||||||
//some additional debugging info
|
//some additional debugging info
|
||||||
#ifdef PRINT_CONTACT_STATISTICS
|
#ifdef PRINT_CONTACT_STATISTICS
|
||||||
printf("num manifolds: %i\n",gNumManifold);
|
printf("num manifolds: %i\n",gNumManifold);
|
||||||
@@ -104,27 +87,11 @@ void BasicDemo::clientMoveAndDisplay()
|
|||||||
#endif //PRINT_CONTACT_STATISTICS
|
#endif //PRINT_CONTACT_STATISTICS
|
||||||
|
|
||||||
gTotalContactPoints = 0;
|
gTotalContactPoints = 0;
|
||||||
glutSwapBuffers();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void BasicDemo::displayCallback(void) {
|
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
||||||
|
|
||||||
if (m_dynamicsWorld)
|
|
||||||
m_dynamicsWorld->updateAabbs();
|
|
||||||
|
|
||||||
renderme();
|
|
||||||
|
|
||||||
glFlush();
|
|
||||||
glutSwapBuffers();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void BasicDemo::initPhysics()
|
void BasicDemo::initPhysics()
|
||||||
@@ -146,7 +113,7 @@ void BasicDemo::initPhysics()
|
|||||||
|
|
||||||
spe_program_handle_t * program_handle;
|
spe_program_handle_t * program_handle;
|
||||||
#ifndef USE_CESOF
|
#ifndef USE_CESOF
|
||||||
char* spuFileName = "../../../Extras/BulletMultiThreaded/out/spuCollision.elf";
|
char* spuFileName = "../../../src/BulletMultiThreaded/out/spuCollision.elf";
|
||||||
|
|
||||||
program_handle = spe_image_open (spuFileName);
|
program_handle = spe_image_open (spuFileName);
|
||||||
if (program_handle == NULL)
|
if (program_handle == NULL)
|
||||||
@@ -193,18 +160,11 @@ void BasicDemo::initPhysics()
|
|||||||
m_solver = sol;
|
m_solver = sol;
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_SIMPLE_DYNAMICS_WORLD
|
|
||||||
//btSimpleDynamicsWorld doesn't support 'cache friendly' optimization, so disable this
|
|
||||||
sol->setSolverMode(btSequentialImpulseConstraintSolver::SOLVER_RANDMIZE_ORDER);
|
|
||||||
m_dynamicsWorld = new btSimpleDynamicsWorld(m_dispatcher,m_overlappingPairCache,m_solver);
|
|
||||||
#else
|
|
||||||
m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_overlappingPairCache,m_solver,m_collisionConfiguration);
|
m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_overlappingPairCache,m_solver,m_collisionConfiguration);
|
||||||
#endif //USE_SIMPLE_DYNAMICS_WORLD
|
|
||||||
m_dynamicsWorld->getDispatchInfo().m_enableSPU = true;
|
m_dynamicsWorld->getDispatchInfo().m_enableSPU = true;
|
||||||
|
|
||||||
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
|
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
|
||||||
|
|
||||||
m_dynamicsWorld->setDebugDrawer(&debugDrawer);
|
|
||||||
|
|
||||||
///create a few basic rigid bodies
|
///create a few basic rigid bodies
|
||||||
|
|
||||||
@@ -248,10 +208,22 @@ void BasicDemo::initPhysics()
|
|||||||
localCreateRigidBody(btScalar(1.),trans,sphereShape);
|
localCreateRigidBody(btScalar(1.),trans,sphereShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
clientResetScene();
|
//clientResetScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
btRigidBody* BasicDemo::localCreateRigidBody(btScalar mass,const btTransform& startTrans,btCollisionShape* colShape)
|
||||||
|
{
|
||||||
|
btVector3 inertia(0,0,0);
|
||||||
|
if (mass)
|
||||||
|
colShape->calculateLocalInertia(mass,inertia);
|
||||||
|
btRigidBody::btRigidBodyConstructionInfo rbci(mass,0,colShape,inertia);
|
||||||
|
rbci.m_startWorldTransform = startTrans;
|
||||||
|
|
||||||
|
btRigidBody* body = new btRigidBody(rbci);
|
||||||
|
m_dynamicsWorld->addRigidBody(body);
|
||||||
|
return body;
|
||||||
|
|
||||||
|
}
|
||||||
void BasicDemo::exitPhysics()
|
void BasicDemo::exitPhysics()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ subject to the following restrictions:
|
|||||||
#ifndef BASIC_DEMO_H
|
#ifndef BASIC_DEMO_H
|
||||||
#define BASIC_DEMO_H
|
#define BASIC_DEMO_H
|
||||||
|
|
||||||
#include "DemoApplication.h"
|
#include "LinearMath/btQuickprof.h"
|
||||||
|
|
||||||
|
|
||||||
|
class btDiscreteDynamicsworld;
|
||||||
class btCollisionShape;
|
class btCollisionShape;
|
||||||
class btOverlappingPairCache;
|
class btOverlappingPairCache;
|
||||||
class btCollisionDispatcher;
|
class btCollisionDispatcher;
|
||||||
@@ -25,8 +25,9 @@ class btConstraintSolver;
|
|||||||
struct btCollisionAlgorithmCreateFunc;
|
struct btCollisionAlgorithmCreateFunc;
|
||||||
|
|
||||||
///BasicDemo is good starting point for learning the code base and porting.
|
///BasicDemo is good starting point for learning the code base and porting.
|
||||||
class BasicDemo : public DemoApplication
|
class BasicDemo
|
||||||
{
|
{
|
||||||
|
btClock m_clock;
|
||||||
|
|
||||||
//keep the collision shapes, for deletion/cleanup
|
//keep the collision shapes, for deletion/cleanup
|
||||||
btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
|
btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
|
||||||
@@ -36,11 +37,15 @@ class BasicDemo : public DemoApplication
|
|||||||
btCollisionDispatcher* m_dispatcher;
|
btCollisionDispatcher* m_dispatcher;
|
||||||
btDefaultCollisionConfiguration* m_collisionConfiguration;
|
btDefaultCollisionConfiguration* m_collisionConfiguration;
|
||||||
btConstraintSolver* m_solver;
|
btConstraintSolver* m_solver;
|
||||||
|
btDiscreteDynamicsWorld* m_dynamicsWorld;
|
||||||
|
|
||||||
btCollisionAlgorithmCreateFunc* m_sphereSphereCF;
|
btCollisionAlgorithmCreateFunc* m_sphereSphereCF;
|
||||||
btCollisionAlgorithmCreateFunc* m_sphereBoxCF;
|
btCollisionAlgorithmCreateFunc* m_sphereBoxCF;
|
||||||
btCollisionAlgorithmCreateFunc* m_boxSphereCF;
|
btCollisionAlgorithmCreateFunc* m_boxSphereCF;
|
||||||
|
|
||||||
|
btRigidBody* localCreateRigidBody(btScalar mass,const btTransform& startTrans,btCollisionShape* colShape);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void initPhysics();
|
void initPhysics();
|
||||||
@@ -49,7 +54,6 @@ class BasicDemo : public DemoApplication
|
|||||||
|
|
||||||
virtual void clientMoveAndDisplay();
|
virtual void clientMoveAndDisplay();
|
||||||
|
|
||||||
virtual void displayCallback();
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -34,12 +34,10 @@ INCLUDE = -DUSE_LIBSPE2 \
|
|||||||
-I$(ROOT)/src \
|
-I$(ROOT)/src \
|
||||||
-I$(ROOT)/Demos/OpenGL \
|
-I$(ROOT)/Demos/OpenGL \
|
||||||
-I$(HOSTINC)
|
-I$(HOSTINC)
|
||||||
SYS_LIBS := -lspe2 -lglut -lGLU -lGL -lm -lXext -lXmu -lX11
|
SYS_LIBS := -lspe2 -lm
|
||||||
|
|
||||||
IMPORTS = $(ROOT)/lib/ibmsdk/bulletmultithreaded.a \
|
IMPORTS = $(ROOT)/lib/ibmsdk/bulletmultithreaded.a \
|
||||||
$(ROOT)/lib/ibmsdk/bulletopenglsupport.a \
|
|
||||||
$(ROOT)/lib/ibmsdk/bulletdynamics.a \
|
$(ROOT)/lib/ibmsdk/bulletdynamics.a \
|
||||||
$(ROOT)/lib/ibmsdk/bulletconvexhull.a \
|
|
||||||
$(ROOT)/lib/ibmsdk/bulletcollision.a \
|
$(ROOT)/lib/ibmsdk/bulletcollision.a \
|
||||||
$(ROOT)/lib/ibmsdk/bulletmath.a
|
$(ROOT)/lib/ibmsdk/bulletmath.a
|
||||||
|
|
||||||
|
|||||||
@@ -28,15 +28,19 @@ CC_OPT_LEVEL = -O3
|
|||||||
|
|
||||||
OBJS = \
|
OBJS = \
|
||||||
btAxisSweep3.o \
|
btAxisSweep3.o \
|
||||||
|
btQuantizedBvh.o \
|
||||||
btBroadphaseProxy.o \
|
btBroadphaseProxy.o \
|
||||||
btCollisionAlgorithm.o \
|
btCollisionAlgorithm.o \
|
||||||
btDispatcher.o \
|
btDispatcher.o \
|
||||||
btOverlappingPairCache.o \
|
btDbvtBroadphase.o \
|
||||||
|
btDbvt.o \
|
||||||
|
btOverlappingPairCache.o \
|
||||||
btSimpleBroadphase.o \
|
btSimpleBroadphase.o \
|
||||||
btContinuousConvexCollision.o \
|
btContinuousConvexCollision.o \
|
||||||
btConvexCast.o \
|
btConvexCast.o \
|
||||||
btGjkConvexCast.o \
|
btGjkConvexCast.o \
|
||||||
btGjkEpa.o \
|
btGjkEpa.o \
|
||||||
|
btGjkEpa2.o \
|
||||||
btGjkEpaPenetrationDepthSolver.o \
|
btGjkEpaPenetrationDepthSolver.o \
|
||||||
btGjkPairDetector.o \
|
btGjkPairDetector.o \
|
||||||
btDefaultCollisionConfiguration.o \
|
btDefaultCollisionConfiguration.o \
|
||||||
@@ -49,9 +53,12 @@ btCollisionDispatcher.o \
|
|||||||
btCollisionObject.o \
|
btCollisionObject.o \
|
||||||
btCollisionWorld.o \
|
btCollisionWorld.o \
|
||||||
btCompoundCollisionAlgorithm.o \
|
btCompoundCollisionAlgorithm.o \
|
||||||
|
btBoxBoxCollisionAlgorithm.o \
|
||||||
|
btBoxBoxDetector.o \
|
||||||
btConvexPlaneCollisionAlgorithm.o \
|
btConvexPlaneCollisionAlgorithm.o \
|
||||||
btConvexConcaveCollisionAlgorithm.o \
|
btConvexConcaveCollisionAlgorithm.o \
|
||||||
btConvexConvexAlgorithm.o \
|
btConvexConvexAlgorithm.o \
|
||||||
|
btDefaultCollisionConfiguration.o \
|
||||||
btEmptyCollisionAlgorithm.o \
|
btEmptyCollisionAlgorithm.o \
|
||||||
btManifoldResult.o \
|
btManifoldResult.o \
|
||||||
btSimulationIslandManager.o \
|
btSimulationIslandManager.o \
|
||||||
|
|||||||
@@ -152,10 +152,17 @@ public:
|
|||||||
//tell the task scheduler we are done with the SPU tasks
|
//tell the task scheduler we are done with the SPU tasks
|
||||||
virtual void stopSPU();
|
virtual void stopSPU();
|
||||||
|
|
||||||
|
virtual void setNumTasks(int numTasks)
|
||||||
|
{
|
||||||
|
//changing the number of tasks after initialization is not implemented (yet)
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
///start the spus (can be called at the beginning of each frame, to make sure that the right SPU program is loaded)
|
///start the spus (can be called at the beginning of each frame, to make sure that the right SPU program is loaded)
|
||||||
void internal_startSPU();
|
void internal_startSPU();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int numThreads;
|
int numThreads;
|
||||||
|
|||||||
Reference in New Issue
Block a user