bt -> b3 and BT -> B3 rename for content and filenames

This commit is contained in:
erwin coumans
2013-04-28 23:11:10 -07:00
parent 6bcb5b9d5f
commit 7366e262fd
178 changed files with 5218 additions and 5218 deletions

View File

@@ -1,8 +1,8 @@
#include "Bullet2GpuDemo.h"
#include "../btGpuDynamicsWorld.h"
#include "../b3GpuDynamicsWorld.h"
#include "GpuRigidBodyDemoInternalData.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "gpu_rigidbody/host/btRigidBody.h"
#include "BulletCollision/CollisionShapes/b3BoxShape.h"
#include "gpu_rigidbody/host/b3RigidBody.h"
void Bullet2GpuDemo::setupScene(const ConstructionInfo& ci)
{
@@ -10,14 +10,14 @@ void Bullet2GpuDemo::setupScene(const ConstructionInfo& ci)
// m_data->m_np = np;
// m_data->m_bp = bp;
// m_data->m_rigidBodyPipeline
m_gpuDynamicsWorld = new btGpuDynamicsWorld(m_data->m_bp,m_data->m_np,m_data->m_rigidBodyPipeline);
m_gpuDynamicsWorld = new b3GpuDynamicsWorld(m_data->m_bp,m_data->m_np,m_data->m_rigidBodyPipeline);
btVector3 halfExtents(100,1,100);
btBoxShape* boxShape = new btBoxShape(halfExtents);
btVector3 localInertia;
btScalar mass=1.f;
b3Vector3 halfExtents(100,1,100);
b3BoxShape* boxShape = new b3BoxShape(halfExtents);
b3Vector3 localInertia;
b3Scalar mass=1.f;
boxShape->calculateLocalInertia(mass,localInertia);
btRigidBody* body = new btRigidBody(mass,0,boxShape,localInertia);
b3RigidBody* body = new b3RigidBody(mass,0,boxShape,localInertia);
m_gpuDynamicsWorld->addRigidBody(body);
}

View File

@@ -7,7 +7,7 @@ class Bullet2GpuDemo : public GpuRigidBodyDemo
{
protected:
class btGpuDynamicsWorld* m_gpuDynamicsWorld;
class b3GpuDynamicsWorld* m_gpuDynamicsWorld;
public:

View File

@@ -14,8 +14,8 @@ subject to the following restrictions:
*/
#include "btCpuDynamicsWorld.h"
#include "btGpuDynamicsWorld.h"
#include "b3CpuDynamicsWorld.h"
#include "b3GpuDynamicsWorld.h"
#define SCALING 1.
@@ -27,20 +27,20 @@ subject to the following restrictions:
#include "GpuDemo.h"
//#include "GlutStuff.h"
///btBulletDynamicsCommon.h is the main Bullet include file, contains most common include files.
//#include "btBulletDynamicsCommon.h"
///b3BulletDynamicsCommon.h is the main Bullet include file, contains most common include files.
//#include "b3BulletDynamicsCommon.h"
#include "BulletCollision/CollisionShapes/btTriangleMesh.h"
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionShapes/btConvexHullShape.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
#include "BulletCollision/CollisionShapes/b3TriangleMesh.h"
#include "BulletCollision/CollisionShapes/b3BvhTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/b3SphereShape.h"
#include "BulletCollision/CollisionShapes/b3ConvexHullShape.h"
#include "BulletCollision/CollisionShapes/b3BoxShape.h"
#include "BulletCollision/CollisionShapes/b3CompoundShape.h"
#include "BulletCollision/CollisionShapes/b3StaticPlaneShape.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
#include "LinearMath/btDefaultMotionState.h"
#include "BulletDynamics/Dynamics/b3RigidBody.h"
#include "LinearMath/b3DefaultMotionState.h"
#include "LinearMath/b3Quickprof.h"
@@ -61,7 +61,7 @@ void GpuDemo::clientMoveAndDisplay()
if (once)
{
once=false;
btDefaultSerializer* serializer = new btDefaultSerializer();
b3DefaultSerializer* serializer = new b3DefaultSerializer();
m_dynamicsWorld->serialize(serializer);
FILE* file = fopen("testFile.bullet","wb");
@@ -103,7 +103,7 @@ void SpheresDemo::setupScene(const ConstructionInfo& ci)
if (1)
{
btSphereShape* sphere = new btSphereShape(1);
b3SphereShape* sphere = new b3SphereShape(1);
m_collisionShapes.push_back(sphere);
/// Create Dynamic Objects
@@ -129,9 +129,9 @@ void SpheresDemo::setupScene(const ConstructionInfo& ci)
float gapZ =ci.gapZ;
for(int j = 0;j<sizeZ;j++)
{
//btCollisionShape* shape = k==0? boxShape : colShape;
//b3CollisionShape* shape = k==0? boxShape : colShape;
btCollisionShape* shape = sphere;
b3CollisionShape* shape = sphere;
b3Scalar mass = 1;
@@ -152,9 +152,9 @@ void SpheresDemo::setupScene(const ConstructionInfo& ci)
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
btRigidBody* body = new btRigidBody(rbInfo);
b3DefaultMotionState* myMotionState = new b3DefaultMotionState(startTransform);
b3RigidBody::b3RigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
b3RigidBody* body = new b3RigidBody(rbInfo);
m_dynamicsWorld->addRigidBody(body);
@@ -167,10 +167,10 @@ void SpheresDemo::setupScene(const ConstructionInfo& ci)
b3Vector3 planeNormal(0,1,0);
b3Scalar planeConstant=0;
btCollisionShape* shape = new btStaticPlaneShape(planeNormal,planeConstant);
//btBoxShape* plane = new btBoxShape(b3Vector3(100,1,100));
b3CollisionShape* shape = new b3StaticPlaneShape(planeNormal,planeConstant);
//b3BoxShape* plane = new b3BoxShape(b3Vector3(100,1,100));
//plane->initializePolyhedralFeatures();
//btSphereShape* shape = new btSphereShape(1000);
//b3SphereShape* shape = new b3SphereShape(1000);
b3Scalar mass(0.);
@@ -184,9 +184,9 @@ void SpheresDemo::setupScene(const ConstructionInfo& ci)
groundTransform.setOrigin(b3Vector3(0,0,0));
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
btRigidBody* body = new btRigidBody(rbInfo);
b3DefaultMotionState* myMotionState = new b3DefaultMotionState(groundTransform);
b3RigidBody::b3RigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
b3RigidBody* body = new b3RigidBody(rbInfo);
//add the body to the dynamics world
m_dynamicsWorld->addRigidBody(body);
@@ -197,12 +197,12 @@ void SpheresDemo::setupScene(const ConstructionInfo& ci)
void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
{
btCollisionShape* groundShape =0;
// btCollisionShape* groundShape = new btStaticPlaneShape(b3Vector3(0,1,0),50);
b3CollisionShape* groundShape =0;
// b3CollisionShape* groundShape = new b3StaticPlaneShape(b3Vector3(0,1,0),50);
if (ci.m_useConcaveMesh)
{
btTriangleMesh* meshInterface = new btTriangleMesh();
b3TriangleMesh* meshInterface = new b3TriangleMesh();
b3AlignedObjectArray<b3Vector3> concaveVertices;
concaveVertices.push_back(b3Vector3(0,-20,0));
@@ -217,16 +217,16 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
meshInterface->addTriangle(concaveVertices[0],concaveVertices[4],concaveVertices[1],true);
#if 0
groundShape = new btBvhTriangleMeshShape(meshInterface,true);//btStaticPlaneShape(b3Vector3(0,1,0),50);
groundShape = new b3BvhTriangleMeshShape(meshInterface,true);//b3StaticPlaneShape(b3Vector3(0,1,0),50);
#else
btBoxShape* shape =new btBoxShape(b3Vector3(b3Scalar(250.),b3Scalar(10.),b3Scalar(250.)));
b3BoxShape* shape =new b3BoxShape(b3Vector3(b3Scalar(250.),b3Scalar(10.),b3Scalar(250.)));
shape->initializePolyhedralFeatures();
groundShape = shape;
#endif
} else
{
groundShape = new btBoxShape(b3Vector3(b3Scalar(250.),b3Scalar(50.),b3Scalar(250.)));
groundShape = new b3BoxShape(b3Vector3(b3Scalar(250.),b3Scalar(50.),b3Scalar(250.)));
}
m_collisionShapes.push_back(groundShape);
@@ -248,9 +248,9 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
groundShape->calculateLocalInertia(mass,localInertia);
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,groundShape,localInertia);
btRigidBody* body = new btRigidBody(rbInfo);
b3DefaultMotionState* myMotionState = new b3DefaultMotionState(groundTransform);
b3RigidBody::b3RigidBodyConstructionInfo rbInfo(mass,myMotionState,groundShape,localInertia);
b3RigidBody* body = new b3RigidBody(rbInfo);
//add the body to the dynamics world
m_dynamicsWorld->addRigidBody(body);
@@ -272,14 +272,14 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
vertices.push_back(b3Vector3(-1,-1,1));
#if 0
btPolyhedralConvexShape* colShape = new btConvexHullShape(&vertices[0].getX(),vertices.size());
b3PolyhedralConvexShape* colShape = new b3ConvexHullShape(&vertices[0].getX(),vertices.size());
colShape->initializePolyhedralFeatures();
#else
btCompoundShape* compoundShape = 0;
b3CompoundShape* compoundShape = 0;
{
btPolyhedralConvexShape* colShape = new btConvexHullShape(&vertices[0].getX(),vertices.size());
b3PolyhedralConvexShape* colShape = new b3ConvexHullShape(&vertices[0].getX(),vertices.size());
colShape->initializePolyhedralFeatures();
compoundShape = new btCompoundShape();
compoundShape = new b3CompoundShape();
b3Transform tr;
tr.setIdentity();
tr.setOrigin(b3Vector3(0,-1,0));
@@ -289,18 +289,18 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
tr.setOrigin(b3Vector3(2,0,0));
compoundShape->addChildShape(tr,colShape);
}
btCollisionShape* colShape = compoundShape;
b3CollisionShape* colShape = compoundShape;
#endif
btPolyhedralConvexShape* boxShape = new btBoxShape(b3Vector3(SCALING*1,SCALING*1,SCALING*1));
b3PolyhedralConvexShape* boxShape = new b3BoxShape(b3Vector3(SCALING*1,SCALING*1,SCALING*1));
boxShape->initializePolyhedralFeatures();
//btCollisionShape* colShape = new btSphereShape(b3Scalar(1.));
//b3CollisionShape* colShape = new b3SphereShape(b3Scalar(1.));
m_collisionShapes.push_back(colShape);
m_collisionShapes.push_back(boxShape);
@@ -329,9 +329,9 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
float gapZ = !ci.m_useConcaveMesh&&k==0? 3.05 : ci.gapZ;
for(int j = 0;j<sizeZ;j++)
{
//btCollisionShape* shape = k==0? boxShape : colShape;
//b3CollisionShape* shape = k==0? boxShape : colShape;
btCollisionShape* shape = colShape;
b3CollisionShape* shape = colShape;
b3Scalar mass = 1;
@@ -352,9 +352,9 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
btRigidBody* body = new btRigidBody(rbInfo);
b3DefaultMotionState* myMotionState = new b3DefaultMotionState(startTransform);
b3RigidBody::b3RigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
b3RigidBody* body = new b3RigidBody(rbInfo);
m_dynamicsWorld->addRigidBody(body);
@@ -368,12 +368,12 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
{
btCollisionShape* groundShape =0;
// btCollisionShape* groundShape = new btStaticPlaneShape(b3Vector3(0,1,0),50);
b3CollisionShape* groundShape =0;
// b3CollisionShape* groundShape = new b3StaticPlaneShape(b3Vector3(0,1,0),50);
if (ci.m_useConcaveMesh)
{
btTriangleMesh* meshInterface = new btTriangleMesh();
b3TriangleMesh* meshInterface = new b3TriangleMesh();
b3AlignedObjectArray<b3Vector3> concaveVertices;
concaveVertices.push_back(b3Vector3(0,-20,0));
@@ -388,16 +388,16 @@ void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
meshInterface->addTriangle(concaveVertices[0],concaveVertices[4],concaveVertices[1],true);
#if 0
groundShape = new btBvhTriangleMeshShape(meshInterface,true);//btStaticPlaneShape(b3Vector3(0,1,0),50);
groundShape = new b3BvhTriangleMeshShape(meshInterface,true);//b3StaticPlaneShape(b3Vector3(0,1,0),50);
#else
btBoxShape* shape =new btBoxShape(b3Vector3(b3Scalar(250.),b3Scalar(10.),b3Scalar(250.)));
b3BoxShape* shape =new b3BoxShape(b3Vector3(b3Scalar(250.),b3Scalar(10.),b3Scalar(250.)));
shape->initializePolyhedralFeatures();
groundShape = shape;
#endif
} else
{
groundShape = new btBoxShape(b3Vector3(b3Scalar(250.),b3Scalar(50.),b3Scalar(250.)));
groundShape = new b3BoxShape(b3Vector3(b3Scalar(250.),b3Scalar(50.),b3Scalar(250.)));
}
m_collisionShapes.push_back(groundShape);
@@ -419,9 +419,9 @@ void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
groundShape->calculateLocalInertia(mass,localInertia);
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,groundShape,localInertia);
btRigidBody* body = new btRigidBody(rbInfo);
b3DefaultMotionState* myMotionState = new b3DefaultMotionState(groundTransform);
b3RigidBody::b3RigidBodyConstructionInfo rbInfo(mass,myMotionState,groundShape,localInertia);
b3RigidBody* body = new b3RigidBody(rbInfo);
//add the body to the dynamics world
m_dynamicsWorld->addRigidBody(body);
@@ -443,14 +443,14 @@ void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
vertices.push_back(b3Vector3(-1,-1,1));
#if 1
btPolyhedralConvexShape* colShape = new btConvexHullShape(&vertices[0].getX(),vertices.size());
b3PolyhedralConvexShape* colShape = new b3ConvexHullShape(&vertices[0].getX(),vertices.size());
colShape->initializePolyhedralFeatures();
#else
btCompoundShape* compoundShape = 0;
b3CompoundShape* compoundShape = 0;
{
btPolyhedralConvexShape* colShape = new btConvexHullShape(&vertices[0].getX(),vertices.size());
b3PolyhedralConvexShape* colShape = new b3ConvexHullShape(&vertices[0].getX(),vertices.size());
colShape->initializePolyhedralFeatures();
compoundShape = new btCompoundShape();
compoundShape = new b3CompoundShape();
b3Transform tr;
tr.setIdentity();
tr.setOrigin(b3Vector3(0,-1,0));
@@ -460,18 +460,18 @@ void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
tr.setOrigin(b3Vector3(2,0,0));
compoundShape->addChildShape(tr,colShape);
}
btCollisionShape* colShape = compoundShape;
b3CollisionShape* colShape = compoundShape;
#endif
btPolyhedralConvexShape* boxShape = new btBoxShape(b3Vector3(SCALING*1,SCALING*1,SCALING*1));
b3PolyhedralConvexShape* boxShape = new b3BoxShape(b3Vector3(SCALING*1,SCALING*1,SCALING*1));
boxShape->initializePolyhedralFeatures();
//btCollisionShape* colShape = new btSphereShape(b3Scalar(1.));
//b3CollisionShape* colShape = new b3SphereShape(b3Scalar(1.));
m_collisionShapes.push_back(colShape);
m_collisionShapes.push_back(boxShape);
@@ -500,9 +500,9 @@ void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
float gapZ = !ci.m_useConcaveMesh&&k==0? 3.05 : ci.gapZ;
for(int j = 0;j<sizeZ;j++)
{
//btCollisionShape* shape = k==0? boxShape : colShape;
//b3CollisionShape* shape = k==0? boxShape : colShape;
btCollisionShape* shape = colShape;
b3CollisionShape* shape = colShape;
b3Scalar mass = 1;
@@ -523,9 +523,9 @@ void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
btRigidBody* body = new btRigidBody(rbInfo);
b3DefaultMotionState* myMotionState = new b3DefaultMotionState(startTransform);
b3RigidBody::b3RigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
b3RigidBody* body = new b3RigidBody(rbInfo);
m_dynamicsWorld->addRigidBody(body);
@@ -546,10 +546,10 @@ void GpuDemo::initPhysics(const ConstructionInfo& ci)
///collision configuration contains default setup for memory, collision setup
if (ci.useOpenCL)
{
m_dynamicsWorld = new btGpuDynamicsWorld(ci.preferredOpenCLPlatformIndex,ci.preferredOpenCLDeviceIndex);
m_dynamicsWorld = new b3GpuDynamicsWorld(ci.preferredOpenCLPlatformIndex,ci.preferredOpenCLDeviceIndex);
} else
{
m_dynamicsWorld = new btCpuDynamicsWorld();
m_dynamicsWorld = new b3CpuDynamicsWorld();
}
@@ -581,8 +581,8 @@ void GpuDemo::exitPhysics()
{
for (i=m_dynamicsWorld->getNumCollisionObjects()-1; i>=0 ;i--)
{
btCollisionObject* obj = m_dynamicsWorld->getCollisionObjectArray()[i];
btRigidBody* body = btRigidBody::upcast(obj);
b3CollisionObject* obj = m_dynamicsWorld->getCollisionObjectArray()[i];
b3RigidBody* body = b3RigidBody::upcast(obj);
if (body && body->getMotionState())
{
delete body->getMotionState();
@@ -595,7 +595,7 @@ void GpuDemo::exitPhysics()
//delete collision shapes
for (int j=0;j<m_collisionShapes.size();j++)
{
btCollisionShape* shape = m_collisionShapes[j];
b3CollisionShape* shape = m_collisionShapes[j];
delete shape;
}
m_collisionShapes.clear();

View File

@@ -19,14 +19,14 @@ subject to the following restrictions:
#include "Bullet3Common/b3AlignedObjectArray.h"
class btBroadphaseInterface;
class btCollisionShape;
class b3BroadphaseInterface;
class b3CollisionShape;
class b3OverlappingPairCache;
class btCollisionDispatcher;
class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration;
class btDynamicsWorld;
class b3CollisionDispatcher;
class b3ConstraintSolver;
struct b3CollisionAlgorithmCreateFunc;
class b3DefaultCollisionConfiguration;
class b3DynamicsWorld;
class GLInstancingRenderer;
///GpuDemo is good starting point for learning the code base and porting.
@@ -38,10 +38,10 @@ class GpuDemo
protected:
btDynamicsWorld* m_dynamicsWorld;
b3DynamicsWorld* m_dynamicsWorld;
//keep the collision shapes, for deletion/cleanup
b3AlignedObjectArray<btCollisionShape*> m_collisionShapes;
b3AlignedObjectArray<b3CollisionShape*> m_collisionShapes;
float getDeltaTimeInSeconds()
{
@@ -99,7 +99,7 @@ public:
virtual void exitPhysics();
virtual const btDynamicsWorld* getDynamicsWorld() const
virtual const b3DynamicsWorld* getDynamicsWorld() const
{
return m_dynamicsWorld;
}

View File

@@ -2,18 +2,18 @@
#include "OpenGL3CoreRenderer.h"
#include "OpenGLWindow/GLInstancingRenderer.h"
#include "OpenGLWindow/ShapeData.h"
//#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
//#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
//#include "BulletDynamics/Dynamics/b3DiscreteDynamicsWorld.h"
//#include "BulletCollision/CollisionDispatch/b3CollisionObject.h"
#include "Bullet3Common/b3Quickprof.h"
/*#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btConvexPolyhedron.h"
#include "BulletCollision/CollisionShapes/btConvexHullShape.h"
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
/*#include "BulletCollision/CollisionShapes/b3BvhTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/b3ConvexPolyhedron.h"
#include "BulletCollision/CollisionShapes/b3ConvexHullShape.h"
#include "BulletCollision/CollisionShapes/b3CollisionShape.h"
#include "BulletCollision/CollisionShapes/b3BoxShape.h"
#include "BulletCollision/CollisionShapes/b3CompoundShape.h"
#include "BulletCollision/CollisionShapes/b3SphereShape.h"
#include "BulletCollision/CollisionShapes/b3StaticPlaneShape.h"
#include "../../rendering/WavefrontObjLoader/objLoader.h"
*/
@@ -61,7 +61,7 @@ struct GraphicsShape
GraphicsShape* createGraphicsShapeFromConvexHull(const btConvexPolyhedron* utilPtr)
GraphicsShape* createGraphicsShapeFromConvexHull(const b3ConvexPolyhedron* utilPtr)
{
b3AlignedObjectArray<GraphicsVertex>* vertices = new b3AlignedObjectArray<GraphicsVertex>;
@@ -71,7 +71,7 @@ GraphicsShape* createGraphicsShapeFromConvexHull(const btConvexPolyhedron* utilP
b3AlignedObjectArray<int>* indicesPtr = new b3AlignedObjectArray<int>;
for (int f=0;f<utilPtr->m_faces.size();f++)
{
const btFace& face = utilPtr->m_faces[f];
const b3Face& face = utilPtr->m_faces[f];
b3Vector3 normal(face.m_plane[0],face.m_plane[1],face.m_plane[2]);
if (face.m_indices.size()>2)
{
@@ -124,7 +124,7 @@ GraphicsShape* createGraphicsShapeFromConvexHull(const btConvexPolyhedron* utilP
}
}
GraphicsShape* createGraphicsShapeFromCompoundShape(btCompoundShape* compound)
GraphicsShape* createGraphicsShapeFromCompoundShape(b3CompoundShape* compound)
{
GraphicsShape* gfxShape = new GraphicsShape();
b3AlignedObjectArray<GraphicsVertex>* vertexArray = new b3AlignedObjectArray<GraphicsVertex>;
@@ -135,13 +135,13 @@ GraphicsShape* createGraphicsShapeFromCompoundShape(btCompoundShape* compound)
//create a graphics shape for each child, combine them into a single graphics shape using their child transforms
for (int i=0;i<compound->getNumChildShapes();i++)
{
btAssert(compound->getChildShape(i)->isPolyhedral());
b3Assert(compound->getChildShape(i)->isPolyhedral());
if (compound->getChildShape(i)->isPolyhedral())
{
btPolyhedralConvexShape* convexHull = (btPolyhedralConvexShape*) compound->getChildShape(i);
b3PolyhedralConvexShape* convexHull = (b3PolyhedralConvexShape*) compound->getChildShape(i);
b3Transform tr = compound->getChildTransform(i);
const btConvexPolyhedron* polyhedron = convexHull->getConvexPolyhedron();
const b3ConvexPolyhedron* polyhedron = convexHull->getConvexPolyhedron();
GraphicsShape* childGfxShape = createGraphicsShapeFromConvexHull(polyhedron);
int baseIndex = vertexArray->size();
@@ -173,8 +173,8 @@ GraphicsShape* createGraphicsShapeFromCompoundShape(btCompoundShape* compound)
}
}
btPolyhedralConvexShape* convexHull = (btPolyhedralConvexShape*) compound->getChildShape(0);
const btConvexPolyhedron* polyhedron = convexHull->getConvexPolyhedron();
b3PolyhedralConvexShape* convexHull = (b3PolyhedralConvexShape*) compound->getChildShape(0);
const b3ConvexPolyhedron* polyhedron = convexHull->getConvexPolyhedron();
GraphicsShape* childGfxShape = createGraphicsShapeFromConvexHull(polyhedron);
gfxShape->m_indices = &indexArray->at(0);
@@ -189,7 +189,7 @@ GraphicsShape* createGraphicsShapeFromCompoundShape(btCompoundShape* compound)
return gfxShape;
}
GraphicsShape* createGraphicsShapeFromConcaveMesh(const btBvhTriangleMeshShape* trimesh)
GraphicsShape* createGraphicsShapeFromConcaveMesh(const b3BvhTriangleMeshShape* trimesh)
{
b3AlignedObjectArray<GraphicsVertex>* vertices = new b3AlignedObjectArray<GraphicsVertex>;
@@ -425,15 +425,15 @@ GraphicsShape* createGraphicsShapeFromWavefrontObj(objLoader* obj)
//very incomplete conversion from physics to graphics
void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOnly, int numObjects, btCollisionObject** colObjArray)
void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOnly, int numObjects, b3CollisionObject** colObjArray)
{
///@todo: we need to sort the objects based on collision shape type, so we can share instances
BT_PROFILE("graphics_from_physics");
B3_PROFILE("graphics_from_physics");
int strideInBytes = sizeof(float)*9;
int prevGraphicsShapeIndex = -1;
btCollisionShape* prevShape = 0;
b3CollisionShape* prevShape = 0;
int numColObj = numObjects;
@@ -444,7 +444,7 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
for (int i=0;i<numColObj;i++)
{
btCollisionObject* colObj = colObjArray[i];
b3CollisionObject* colObj = colObjArray[i];
b3Vector3 pos = colObj->getWorldTransform().getOrigin();
b3Quaternion orn = colObj->getWorldTransform().getRotation();
@@ -470,8 +470,8 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
{
if (colObj->getCollisionShape()->isPolyhedral())
{
btPolyhedralConvexShape* polyShape = (btPolyhedralConvexShape*)colObj->getCollisionShape();
const btConvexPolyhedron* pol = polyShape->getConvexPolyhedron();
b3PolyhedralConvexShape* polyShape = (b3PolyhedralConvexShape*)colObj->getCollisionShape();
const b3ConvexPolyhedron* pol = polyShape->getConvexPolyhedron();
GraphicsShape* gfxShape = createGraphicsShapeFromConvexHull(pol);
prevGraphicsShapeIndex = renderer.registerShape(&gfxShape->m_vertices[0],gfxShape->m_numvertices,gfxShape->m_indices,gfxShape->m_numIndices);
@@ -482,7 +482,7 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
{
if (colObj->getCollisionShape()->getShapeType()==TRIANGLE_MESH_SHAPE_PROXYTYPE)
{
btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*) colObj->getCollisionShape();
b3BvhTriangleMeshShape* trimesh = (b3BvhTriangleMeshShape*) colObj->getCollisionShape();
GraphicsShape* gfxShape = createGraphicsShapeFromConcaveMesh(trimesh);
prevGraphicsShapeIndex = renderer.registerShape(&gfxShape->m_vertices[0],gfxShape->m_numvertices,gfxShape->m_indices,gfxShape->m_numIndices);
prevShape = colObj->getCollisionShape();
@@ -492,7 +492,7 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
{
if (colObj->getCollisionShape()->getShapeType()==COMPOUND_SHAPE_PROXYTYPE)
{
btCompoundShape* compound = (btCompoundShape*) colObj->getCollisionShape();
b3CompoundShape* compound = (b3CompoundShape*) colObj->getCollisionShape();
GraphicsShape* gfxShape = createGraphicsShapeFromCompoundShape(compound);
if (gfxShape)
{
@@ -508,11 +508,11 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
{
if (colObj->getCollisionShape()->getShapeType()==SPHERE_SHAPE_PROXYTYPE)
{
btSphereShape* sphere = (btSphereShape*) colObj->getCollisionShape();
b3SphereShape* sphere = (b3SphereShape*) colObj->getCollisionShape();
b3Scalar radius = sphere->getRadius();
//btConvexHullShape* spherePoly = new btConvexHullShape(
//const btConvexPolyhedron* pol = polyShape->getConvexPolyhedron();
//b3ConvexHullShape* spherePoly = new b3ConvexHullShape(
//const b3ConvexPolyhedron* pol = polyShape->getConvexPolyhedron();
/*
objLoader loader;
@@ -572,7 +572,7 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
{
int numVertices = sizeof(point_sphere_vertices)/strideInBytes;
int numIndices = sizeof(point_sphere_indices)/sizeof(int);
prevGraphicsShapeIndex = renderer.registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,BT_GL_POINTS);
prevGraphicsShapeIndex = renderer.registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,B3_GL_POINTS);
} else
{
if (radius>=10)
@@ -599,7 +599,7 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
{
if (colObj->getCollisionShape()->getShapeType()==STATIC_PLANE_PROXYTYPE)
{
btStaticPlaneShape* plane= (btStaticPlaneShape*) colObj->getCollisionShape();
b3StaticPlaneShape* plane= (b3StaticPlaneShape*) colObj->getCollisionShape();
prevShape = colObj->getCollisionShape();
//plane->getPlaneNormal()
@@ -624,7 +624,7 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
{
printf("Error: unsupported collision shape type in %s %d\n", __FILE__, __LINE__);
prevGraphicsShapeIndex = -1;
btAssert(0);
b3Assert(0);
}
}
}
@@ -660,7 +660,7 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
void OpenGL3CoreRenderer::renderPhysicsWorld(int numObjects, btCollisionObject** colObjArray, bool syncOnly)
void OpenGL3CoreRenderer::renderPhysicsWorld(int numObjects, b3CollisionObject** colObjArray, bool syncOnly)
{
//sync changes from physics world to render world
//for now, we don't deal with adding/removing objects to the world during the simulation, to keep the rendererer simpler

View File

@@ -1,7 +1,7 @@
#ifndef OPENGL3_CORE_RENDERER_H
#define OPENGL3_CORE_RENDERER_H
class btCollisionObject;
class b3CollisionObject;
class GLInstancingRenderer;
class OpenGL3CoreRenderer
@@ -14,7 +14,7 @@ public:
void init();
void reshape(int w, int h);
void keyboardCallback(unsigned char key);
void renderPhysicsWorld(int numObjects, btCollisionObject** colObjArray, bool syncOnly);
void renderPhysicsWorld(int numObjects, b3CollisionObject** colObjArray, bool syncOnly);
GLInstancingRenderer* getInstancingRenderer()
{

View File

@@ -0,0 +1,17 @@
#include "b3CpuDynamicsWorld.h"
#include "b3BulletDynamicsCommon.h"
b3CpuDynamicsWorld::b3CpuDynamicsWorld()
:b3DiscreteDynamicsWorld(
new b3CollisionDispatcher(new b3DefaultCollisionConfiguration()),
new b3DynamicBvhBroadphase(),new b3SequentialImpulseConstraintSolver(),
new b3DefaultCollisionConfiguration()//todo: remove this!
)
{
}
b3CpuDynamicsWorld::~b3CpuDynamicsWorld()
{
}

View File

@@ -0,0 +1,24 @@
#ifndef B3_CPU_DYNAMICS_WORLD_H
#define B3_CPU_DYNAMICS_WORLD_H
class b3DefaultCollisionConfiguration;
class b3CollisionDispatcher;
struct b3DynamicBvhBroadphase;
class b3SequentialImpulseConstraintSolver;
#include "BulletDynamics/Dynamics/b3DiscreteDynamicsWorld.h"
class b3CpuDynamicsWorld : public b3DiscreteDynamicsWorld
{
public:
b3CpuDynamicsWorld();
virtual ~b3CpuDynamicsWorld();
};
#endif //B3_CPU_DYNAMICS_WORLD_H

View File

@@ -1,13 +1,13 @@
#include "btGpuDynamicsWorld.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
#include "b3GpuDynamicsWorld.h"
#include "BulletDynamics/Dynamics/b3RigidBody.h"
#include "../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.h"
#include "../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.h"
#include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
#include "../../../opencl/gpu_rigidbody_pipeline/b3GpuNarrowPhaseAndSolver.h"
#include "BulletCollision/CollisionShapes/b3PolyhedralConvexShape.h"
#include "BulletCollision/CollisionShapes/b3BvhTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/b3CompoundShape.h"
#include "BulletCollision/CollisionShapes/b3SphereShape.h"
#include "BulletCollision/CollisionShapes/b3StaticPlaneShape.h"
#include "LinearMath/b3Quickprof.h"
@@ -18,8 +18,8 @@
btGpuDynamicsWorld::btGpuDynamicsWorld(int preferredOpenCLPlatformIndex,int preferredOpenCLDeviceIndex)
:btDynamicsWorld(0,0,0),
b3GpuDynamicsWorld::b3GpuDynamicsWorld(int preferredOpenCLPlatformIndex,int preferredOpenCLDeviceIndex)
:b3DynamicsWorld(0,0,0),
m_gravity(0,-10,0),
m_once(true)
{
@@ -29,12 +29,12 @@ m_once(true)
m_gpuPhysics->init(preferredOpenCLDeviceIndex,preferredOpenCLPlatformIndex,useInterop);
}
btGpuDynamicsWorld::~btGpuDynamicsWorld()
b3GpuDynamicsWorld::~b3GpuDynamicsWorld()
{
delete m_gpuPhysics;
}
void btGpuDynamicsWorld::exitOpenCL()
void b3GpuDynamicsWorld::exitOpenCL()
{
}
@@ -43,13 +43,13 @@ void btGpuDynamicsWorld::exitOpenCL()
int btGpuDynamicsWorld::stepSimulation( b3Scalar timeStep,int maxSubSteps, b3Scalar fixedTimeStep)
int b3GpuDynamicsWorld::stepSimulation( b3Scalar timeStep,int maxSubSteps, b3Scalar fixedTimeStep)
{
#ifndef BT_NO_PROFILE
#ifndef B3_NO_PROFILE
// CProfileManager::Reset();
#endif //BT_NO_PROFILE
#endif //B3_NO_PROFILE
BT_PROFILE("stepSimulation");
B3_PROFILE("stepSimulation");
//convert all shapes now, and if any change, reset all (todo)
@@ -63,14 +63,14 @@ int btGpuDynamicsWorld::stepSimulation( b3Scalar timeStep,int maxSubSteps, b3Sc
{
{
BT_PROFILE("readbackBodiesToCpu");
B3_PROFILE("readbackBodiesToCpu");
//now copy info back to rigid bodies....
m_gpuPhysics->readbackBodiesToCpu();
}
{
BT_PROFILE("scatter transforms into rigidbody (CPU)");
B3_PROFILE("scatter transforms into rigidbody (CPU)");
for (int i=0;i<this->m_collisionObjects.size();i++)
{
b3Vector3 pos;
@@ -85,20 +85,20 @@ int btGpuDynamicsWorld::stepSimulation( b3Scalar timeStep,int maxSubSteps, b3Sc
}
#ifndef BT_NO_PROFILE
#ifndef B3_NO_PROFILE
//CProfileManager::Increment_Frame_Counter();
#endif //BT_NO_PROFILE
#endif //B3_NO_PROFILE
return 1;
}
void btGpuDynamicsWorld::setGravity(const b3Vector3& gravity)
void b3GpuDynamicsWorld::setGravity(const b3Vector3& gravity)
{
}
int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* colShape)
int b3GpuDynamicsWorld::findOrRegisterCollisionShape(const b3CollisionShape* colShape)
{
int index = m_uniqueShapes.findLinearSearch(colShape);
if (index==m_uniqueShapes.size())
@@ -107,7 +107,7 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
{
m_uniqueShapes.push_back(colShape);
btPolyhedralConvexShape* convex = (btPolyhedralConvexShape*)colShape;
b3PolyhedralConvexShape* convex = (b3PolyhedralConvexShape*)colShape;
int numVertices=convex->getNumVertices();
int strideInBytes=sizeof(b3Vector3);
@@ -126,7 +126,7 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
{
m_uniqueShapes.push_back(colShape);
btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*) colShape;
b3BvhTriangleMeshShape* trimesh = (b3BvhTriangleMeshShape*) colShape;
b3StridingMeshInterface* meshInterface = trimesh->getMeshInterface();
b3AlignedObjectArray<b3Vector3> vertices;
b3AlignedObjectArray<int> indices;
@@ -181,9 +181,9 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
indices.push_back(indices.size());
}
}
//GraphicsShape* gfxShape = 0;//btBulletDataExtractor::createGraphicsShapeFromWavefrontObj(objData);
//GraphicsShape* gfxShape = 0;//b3BulletDataExtractor::createGraphicsShapeFromWavefrontObj(objData);
//GraphicsShape* gfxShape = btBulletDataExtractor::createGraphicsShapeFromConvexHull(&sUnitSpherePoints[0],MY_UNITSPHERE_POINTS);
//GraphicsShape* gfxShape = b3BulletDataExtractor::createGraphicsShapeFromConvexHull(&sUnitSpherePoints[0],MY_UNITSPHERE_POINTS);
float meshScaling[4] = {1,1,1,1};
//int shapeIndex = renderer.registerShape(gfxShape->m_vertices,gfxShape->m_numvertices,gfxShape->m_indices,gfxShape->m_numIndices);
float groundPos[4] = {0,0,0,0};
@@ -195,9 +195,9 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
m_uniqueShapeMapping.push_back(gpuShapeIndex);
} else
{
printf("Error: no vertices in mesh in btGpuDynamicsWorld::addRigidBody\n");
printf("Error: no vertices in mesh in b3GpuDynamicsWorld::addRigidBody\n");
index = -1;
btAssert(0);
b3Assert(0);
}
@@ -206,14 +206,14 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
if (colShape->getShapeType()==COMPOUND_SHAPE_PROXYTYPE)
{
btCompoundShape* compound = (btCompoundShape*) colShape;
b3AlignedObjectArray<btGpuChildShape> childShapes;
b3CompoundShape* compound = (b3CompoundShape*) colShape;
b3AlignedObjectArray<b3GpuChildShape> childShapes;
for (int i=0;i<compound->getNumChildShapes();i++)
{
//for now, only support polyhedral child shapes
btAssert(compound->getChildShape(i)->isPolyhedral());
btGpuChildShape child;
b3Assert(compound->getChildShape(i)->isPolyhedral());
b3GpuChildShape child;
child.m_shapeIndex = findOrRegisterCollisionShape(compound->getChildShape(i));
b3Vector3 pos = compound->getChildTransform(i).getOrigin();
b3Quaternion orn = compound->getChildTransform(i).getRotation();
@@ -233,16 +233,16 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
/*printf("Error: unsupported compound type (%d) in btGpuDynamicsWorld::addRigidBody\n",colShape->getShapeType());
/*printf("Error: unsupported compound type (%d) in b3GpuDynamicsWorld::addRigidBody\n",colShape->getShapeType());
index = -1;
btAssert(0);
b3Assert(0);
*/
} else
{
if (colShape->getShapeType()==SPHERE_SHAPE_PROXYTYPE)
{
m_uniqueShapes.push_back(colShape);
btSphereShape* sphere = (btSphereShape*)colShape;
b3SphereShape* sphere = (b3SphereShape*)colShape;
int gpuShapeIndex = m_gpuPhysics->registerSphereShape(sphere->getRadius());
m_uniqueShapeMapping.push_back(gpuShapeIndex);
@@ -251,15 +251,15 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
if (colShape->getShapeType()==STATIC_PLANE_PROXYTYPE)
{
m_uniqueShapes.push_back(colShape);
btStaticPlaneShape* plane = (btStaticPlaneShape*)colShape;
b3StaticPlaneShape* plane = (b3StaticPlaneShape*)colShape;
int gpuShapeIndex = m_gpuPhysics->registerPlaneShape(plane->getPlaneNormal(),plane->getPlaneConstant());
m_uniqueShapeMapping.push_back(gpuShapeIndex);
} else
{
printf("Error: unsupported shape type (%d) in btGpuDynamicsWorld::addRigidBody\n",colShape->getShapeType());
printf("Error: unsupported shape type (%d) in b3GpuDynamicsWorld::addRigidBody\n",colShape->getShapeType());
index = -1;
btAssert(0);
b3Assert(0);
}
}
}
@@ -271,7 +271,7 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
return index;
}
void btGpuDynamicsWorld::addRigidBody(btRigidBody* body)
void b3GpuDynamicsWorld::addRigidBody(b3RigidBody* body)
{
body->setMotionState(0);
@@ -292,9 +292,9 @@ void btGpuDynamicsWorld::addRigidBody(btRigidBody* body)
}
}
void btGpuDynamicsWorld::removeCollisionObject(btCollisionObject* colObj)
void b3GpuDynamicsWorld::removeCollisionObject(b3CollisionObject* colObj)
{
btDynamicsWorld::removeCollisionObject(colObj);
b3DynamicsWorld::removeCollisionObject(colObj);
}

View File

@@ -0,0 +1,109 @@
#ifndef B3_GPU_DYNAMICS_WORLD_H
#define B3_GPU_DYNAMICS_WORLD_H
class b3Vector3;
class b3RigidBody;
class b3CollisionObject;
struct b3GpuInternalData;//use this struct to avoid 'leaking' all OpenCL headers into clients code base
class CLPhysicsDemo;
#include "Bullet3Common/b3AlignedObjectArray.h"
//#include "BulletDynamics/Dynamics/b3DynamicsWorld.h"
class b3GpuDynamicsWorld //: public b3DynamicsWorld
{
b3AlignedObjectArray<const class b3CollisionShape*> m_uniqueShapes;
b3AlignedObjectArray<int> m_uniqueShapeMapping;
CLPhysicsDemo* m_gpuPhysics;
b3Vector3 m_gravity;
bool m_once;
bool initOpenCL(int preferredDeviceIndex, int preferredPlatformIndex, bool useInterop);
void exitOpenCL();
int findOrRegisterCollisionShape(const b3CollisionShape* colShape);
public:
b3GpuDynamicsWorld(int preferredOpenCLPlatformIndex,int preferredOpenCLDeviceIndex);
virtual ~b3GpuDynamicsWorld();
virtual int stepSimulation( b3Scalar timeStep,int maxSubSteps=1, b3Scalar fixedTimeStep=b3Scalar(1.)/b3Scalar(60.));
virtual void synchronizeMotionStates()
{
b3Assert(0);
}
void debugDrawWorld() {}
void setGravity(const b3Vector3& gravity);
void addRigidBody(b3RigidBody* body);
void removeCollisionObject(b3CollisionObject* colObj);
b3AlignedObjectArray<class b3CollisionObject*>& getCollisionObjectArray();
const b3AlignedObjectArray<class b3CollisionObject*>& getCollisionObjectArray() const;
virtual void addAction(b3ActionInterface* action)
{
b3Assert(0);
}
virtual void removeAction(b3ActionInterface* action)
{
b3Assert(0);
}
b3Vector3 getGravity () const
{
return m_gravity;
}
virtual void addRigidBody(b3RigidBody* body, short group, short mask)
{
addRigidBody(body);
}
virtual void removeRigidBody(b3RigidBody* body)
{
b3Assert(0);
}
virtual void setConstraintSolver(b3ConstraintSolver* solver)
{
b3Assert(0);
}
virtual b3ConstraintSolver* getConstraintSolver()
{
b3Assert(0);
return 0;
}
virtual b3DynamicsWorldType getWorldType() const
{
return B3_GPU_PHYSICS_WORLD;
}
virtual void clearForces()
{
b3Assert(0);
}
};
#endif //B3_GPU_DYNAMICS_WORLD_H

View File

@@ -1,17 +0,0 @@
#include "btCpuDynamicsWorld.h"
#include "btBulletDynamicsCommon.h"
btCpuDynamicsWorld::btCpuDynamicsWorld()
:btDiscreteDynamicsWorld(
new btCollisionDispatcher(new btDefaultCollisionConfiguration()),
new b3DynamicBvhBroadphase(),new btSequentialImpulseConstraintSolver(),
new btDefaultCollisionConfiguration()//todo: remove this!
)
{
}
btCpuDynamicsWorld::~btCpuDynamicsWorld()
{
}

View File

@@ -1,24 +0,0 @@
#ifndef BT_CPU_DYNAMICS_WORLD_H
#define BT_CPU_DYNAMICS_WORLD_H
class btDefaultCollisionConfiguration;
class btCollisionDispatcher;
struct b3DynamicBvhBroadphase;
class btSequentialImpulseConstraintSolver;
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
class btCpuDynamicsWorld : public btDiscreteDynamicsWorld
{
public:
btCpuDynamicsWorld();
virtual ~btCpuDynamicsWorld();
};
#endif //BT_CPU_DYNAMICS_WORLD_H

View File

@@ -1,109 +0,0 @@
#ifndef BT_GPU_DYNAMICS_WORLD_H
#define BT_GPU_DYNAMICS_WORLD_H
class b3Vector3;
class btRigidBody;
class btCollisionObject;
struct btGpuInternalData;//use this struct to avoid 'leaking' all OpenCL headers into clients code base
class CLPhysicsDemo;
#include "Bullet3Common/b3AlignedObjectArray.h"
//#include "BulletDynamics/Dynamics/btDynamicsWorld.h"
class btGpuDynamicsWorld //: public btDynamicsWorld
{
b3AlignedObjectArray<const class btCollisionShape*> m_uniqueShapes;
b3AlignedObjectArray<int> m_uniqueShapeMapping;
CLPhysicsDemo* m_gpuPhysics;
b3Vector3 m_gravity;
bool m_once;
bool initOpenCL(int preferredDeviceIndex, int preferredPlatformIndex, bool useInterop);
void exitOpenCL();
int findOrRegisterCollisionShape(const btCollisionShape* colShape);
public:
btGpuDynamicsWorld(int preferredOpenCLPlatformIndex,int preferredOpenCLDeviceIndex);
virtual ~btGpuDynamicsWorld();
virtual int stepSimulation( b3Scalar timeStep,int maxSubSteps=1, b3Scalar fixedTimeStep=b3Scalar(1.)/b3Scalar(60.));
virtual void synchronizeMotionStates()
{
btAssert(0);
}
void debugDrawWorld() {}
void setGravity(const b3Vector3& gravity);
void addRigidBody(btRigidBody* body);
void removeCollisionObject(btCollisionObject* colObj);
b3AlignedObjectArray<class btCollisionObject*>& getCollisionObjectArray();
const b3AlignedObjectArray<class btCollisionObject*>& getCollisionObjectArray() const;
virtual void addAction(btActionInterface* action)
{
btAssert(0);
}
virtual void removeAction(btActionInterface* action)
{
btAssert(0);
}
b3Vector3 getGravity () const
{
return m_gravity;
}
virtual void addRigidBody(btRigidBody* body, short group, short mask)
{
addRigidBody(body);
}
virtual void removeRigidBody(btRigidBody* body)
{
btAssert(0);
}
virtual void setConstraintSolver(btConstraintSolver* solver)
{
btAssert(0);
}
virtual btConstraintSolver* getConstraintSolver()
{
btAssert(0);
return 0;
}
virtual btDynamicsWorldType getWorldType() const
{
return BT_GPU_PHYSICS_WORLD;
}
virtual void clearForces()
{
btAssert(0);
}
};
#endif //BT_GPU_DYNAMICS_WORLD_H