more bt* to b3*

This commit is contained in:
erwin coumans
2013-04-16 17:08:59 -07:00
parent faabffc23d
commit e646754228
116 changed files with 2466 additions and 3034 deletions

View File

@@ -23,7 +23,7 @@ subject to the following restrictions:
#define START_POS_Y 10
#define START_POS_Z -3
#include "LinearMath/btVector3.h"
#include "LinearMath/b3Vector3.h"
#include "GpuDemo.h"
//#include "GlutStuff.h"
@@ -41,7 +41,7 @@ subject to the following restrictions:
#include "BulletDynamics/Dynamics/btRigidBody.h"
#include "LinearMath/btDefaultMotionState.h"
#include "LinearMath/btQuickprof.h"
#include "LinearMath/b3Quickprof.h"
#include <stdio.h> //printf debugging
@@ -90,7 +90,7 @@ void GpuDemo::clientMoveAndDisplay()
btAlignedObjectArray<btVector3> vertices;
b3AlignedObjectArray<b3Vector3> vertices;
void EmptyDemo::setupScene(const ConstructionInfo& ci)
{
@@ -107,7 +107,7 @@ void SpheresDemo::setupScene(const ConstructionInfo& ci)
m_collisionShapes.push_back(sphere);
/// Create Dynamic Objects
btTransform startTransform;
b3Transform startTransform;
startTransform.setIdentity();
@@ -134,21 +134,21 @@ void SpheresDemo::setupScene(const ConstructionInfo& ci)
btCollisionShape* shape = sphere;
btScalar mass = 1;
b3Scalar mass = 1;
if (!ci.m_useConcaveMesh && k==0)
mass = k==0? 0.f : 1.f;
//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);
btVector3 localInertia(0,0,0);
b3Vector3 localInertia(0,0,0);
if (isDynamic)
shape->calculateLocalInertia(mass,localInertia);
startTransform.setOrigin(SCALING*btVector3(
btScalar(gapX*i + start_x),
btScalar(ci.gapY*k + start_y),
btScalar(gapZ*j + start_z)));
startTransform.setOrigin(SCALING*b3Vector3(
b3Scalar(gapX*i + start_x),
b3Scalar(ci.gapY*k + start_y),
b3Scalar(gapZ*j + start_z)));
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
@@ -164,24 +164,24 @@ void SpheresDemo::setupScene(const ConstructionInfo& ci)
}
{
btVector3 planeNormal(0,1,0);
btScalar planeConstant=0;
b3Vector3 planeNormal(0,1,0);
b3Scalar planeConstant=0;
btCollisionShape* shape = new btStaticPlaneShape(planeNormal,planeConstant);
//btBoxShape* plane = new btBoxShape(btVector3(100,1,100));
//btBoxShape* plane = new btBoxShape(b3Vector3(100,1,100));
//plane->initializePolyhedralFeatures();
//btSphereShape* shape = new btSphereShape(1000);
btScalar mass(0.);
b3Scalar mass(0.);
//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);
btVector3 localInertia(0,0,0);
btTransform groundTransform;
b3Vector3 localInertia(0,0,0);
b3Transform groundTransform;
groundTransform.setIdentity();
groundTransform.setRotation(btQuaternion(btVector3(1,0,0),0.3));
groundTransform.setOrigin(btVector3(0,0,0));
groundTransform.setRotation(b3Quaternion(b3Vector3(1,0,0),0.3));
groundTransform.setOrigin(b3Vector3(0,0,0));
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
@@ -198,18 +198,18 @@ void SpheresDemo::setupScene(const ConstructionInfo& ci)
void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
{
btCollisionShape* groundShape =0;
// btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),50);
// btCollisionShape* groundShape = new btStaticPlaneShape(b3Vector3(0,1,0),50);
if (ci.m_useConcaveMesh)
{
btTriangleMesh* meshInterface = new btTriangleMesh();
btAlignedObjectArray<btVector3> concaveVertices;
concaveVertices.push_back(btVector3(0,-20,0));
concaveVertices.push_back(btVector3(80,10,80));
concaveVertices.push_back(btVector3(80,10,-80));
concaveVertices.push_back(btVector3(-80,10,-80));
concaveVertices.push_back(btVector3(-80,10,80));
b3AlignedObjectArray<b3Vector3> concaveVertices;
concaveVertices.push_back(b3Vector3(0,-20,0));
concaveVertices.push_back(b3Vector3(80,10,80));
concaveVertices.push_back(b3Vector3(80,10,-80));
concaveVertices.push_back(b3Vector3(-80,10,-80));
concaveVertices.push_back(b3Vector3(-80,10,80));
meshInterface->addTriangle(concaveVertices[0],concaveVertices[1],concaveVertices[2],true);
meshInterface->addTriangle(concaveVertices[0],concaveVertices[2],concaveVertices[3],true);
@@ -217,33 +217,33 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
meshInterface->addTriangle(concaveVertices[0],concaveVertices[4],concaveVertices[1],true);
#if 0
groundShape = new btBvhTriangleMeshShape(meshInterface,true);//btStaticPlaneShape(btVector3(0,1,0),50);
groundShape = new btBvhTriangleMeshShape(meshInterface,true);//btStaticPlaneShape(b3Vector3(0,1,0),50);
#else
btBoxShape* shape =new btBoxShape(btVector3(btScalar(250.),btScalar(10.),btScalar(250.)));
btBoxShape* shape =new btBoxShape(b3Vector3(b3Scalar(250.),b3Scalar(10.),b3Scalar(250.)));
shape->initializePolyhedralFeatures();
groundShape = shape;
#endif
} else
{
groundShape = new btBoxShape(btVector3(btScalar(250.),btScalar(50.),btScalar(250.)));
groundShape = new btBoxShape(b3Vector3(b3Scalar(250.),b3Scalar(50.),b3Scalar(250.)));
}
m_collisionShapes.push_back(groundShape);
btTransform groundTransform;
b3Transform groundTransform;
groundTransform.setIdentity();
groundTransform.setOrigin(btVector3(0,0,0));
groundTransform.setOrigin(b3Vector3(0,0,0));
//We can also use DemoApplication::localCreateRigidBody, but for clarity it is provided here:
if (ci.m_useConcaveMesh)
{
btScalar mass(0.);
b3Scalar mass(0.);
//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);
btVector3 localInertia(0,0,0);
b3Vector3 localInertia(0,0,0);
if (isDynamic)
groundShape->calculateLocalInertia(mass,localInertia);
@@ -261,15 +261,15 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
//create a few dynamic rigidbodies
// Re-using the same collision is better for memory usage and performance
//vertices.push_back(btVector3(0,1,0));
vertices.push_back(btVector3(1,1,1));
vertices.push_back(btVector3(1,1,-1));
vertices.push_back(btVector3(-1,1,-1));
vertices.push_back(btVector3(-1,1,1));
vertices.push_back(btVector3(1,-1,1));
vertices.push_back(btVector3(1,-1,-1));
vertices.push_back(btVector3(-1,-1,-1));
vertices.push_back(btVector3(-1,-1,1));
//vertices.push_back(b3Vector3(0,1,0));
vertices.push_back(b3Vector3(1,1,1));
vertices.push_back(b3Vector3(1,1,-1));
vertices.push_back(b3Vector3(-1,1,-1));
vertices.push_back(b3Vector3(-1,1,1));
vertices.push_back(b3Vector3(1,-1,1));
vertices.push_back(b3Vector3(1,-1,-1));
vertices.push_back(b3Vector3(-1,-1,-1));
vertices.push_back(b3Vector3(-1,-1,1));
#if 0
btPolyhedralConvexShape* colShape = new btConvexHullShape(&vertices[0].getX(),vertices.size());
@@ -280,13 +280,13 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
btPolyhedralConvexShape* colShape = new btConvexHullShape(&vertices[0].getX(),vertices.size());
colShape->initializePolyhedralFeatures();
compoundShape = new btCompoundShape();
btTransform tr;
b3Transform tr;
tr.setIdentity();
tr.setOrigin(btVector3(0,-1,0));
tr.setOrigin(b3Vector3(0,-1,0));
compoundShape->addChildShape(tr,colShape);
tr.setOrigin(btVector3(0,0,2));
tr.setOrigin(b3Vector3(0,0,2));
compoundShape->addChildShape(tr,colShape);
tr.setOrigin(btVector3(2,0,0));
tr.setOrigin(b3Vector3(2,0,0));
compoundShape->addChildShape(tr,colShape);
}
btCollisionShape* colShape = compoundShape;
@@ -294,18 +294,18 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
btPolyhedralConvexShape* boxShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
btPolyhedralConvexShape* boxShape = new btBoxShape(b3Vector3(SCALING*1,SCALING*1,SCALING*1));
boxShape->initializePolyhedralFeatures();
//btCollisionShape* colShape = new btSphereShape(btScalar(1.));
//btCollisionShape* colShape = new btSphereShape(b3Scalar(1.));
m_collisionShapes.push_back(colShape);
m_collisionShapes.push_back(boxShape);
/// Create Dynamic Objects
btTransform startTransform;
b3Transform startTransform;
startTransform.setIdentity();
@@ -334,21 +334,21 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
btCollisionShape* shape = colShape;
btScalar mass = 1;
b3Scalar mass = 1;
if (!ci.m_useConcaveMesh && k==0)
mass = k==0? 0.f : 1.f;
//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);
btVector3 localInertia(0,0,0);
b3Vector3 localInertia(0,0,0);
if (isDynamic)
shape->calculateLocalInertia(mass,localInertia);
startTransform.setOrigin(SCALING*btVector3(
btScalar(startX+gapX*i + start_x),
btScalar(20+ci.gapY*k + start_y),
btScalar(startZ+gapZ*j + start_z)));
startTransform.setOrigin(SCALING*b3Vector3(
b3Scalar(startX+gapX*i + start_x),
b3Scalar(20+ci.gapY*k + start_y),
b3Scalar(startZ+gapZ*j + start_z)));
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
@@ -369,18 +369,18 @@ void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
{
btCollisionShape* groundShape =0;
// btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),50);
// btCollisionShape* groundShape = new btStaticPlaneShape(b3Vector3(0,1,0),50);
if (ci.m_useConcaveMesh)
{
btTriangleMesh* meshInterface = new btTriangleMesh();
btAlignedObjectArray<btVector3> concaveVertices;
concaveVertices.push_back(btVector3(0,-20,0));
concaveVertices.push_back(btVector3(80,10,80));
concaveVertices.push_back(btVector3(80,10,-80));
concaveVertices.push_back(btVector3(-80,10,-80));
concaveVertices.push_back(btVector3(-80,10,80));
b3AlignedObjectArray<b3Vector3> concaveVertices;
concaveVertices.push_back(b3Vector3(0,-20,0));
concaveVertices.push_back(b3Vector3(80,10,80));
concaveVertices.push_back(b3Vector3(80,10,-80));
concaveVertices.push_back(b3Vector3(-80,10,-80));
concaveVertices.push_back(b3Vector3(-80,10,80));
meshInterface->addTriangle(concaveVertices[0],concaveVertices[1],concaveVertices[2],true);
meshInterface->addTriangle(concaveVertices[0],concaveVertices[2],concaveVertices[3],true);
@@ -388,33 +388,33 @@ void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
meshInterface->addTriangle(concaveVertices[0],concaveVertices[4],concaveVertices[1],true);
#if 0
groundShape = new btBvhTriangleMeshShape(meshInterface,true);//btStaticPlaneShape(btVector3(0,1,0),50);
groundShape = new btBvhTriangleMeshShape(meshInterface,true);//btStaticPlaneShape(b3Vector3(0,1,0),50);
#else
btBoxShape* shape =new btBoxShape(btVector3(btScalar(250.),btScalar(10.),btScalar(250.)));
btBoxShape* shape =new btBoxShape(b3Vector3(b3Scalar(250.),b3Scalar(10.),b3Scalar(250.)));
shape->initializePolyhedralFeatures();
groundShape = shape;
#endif
} else
{
groundShape = new btBoxShape(btVector3(btScalar(250.),btScalar(50.),btScalar(250.)));
groundShape = new btBoxShape(b3Vector3(b3Scalar(250.),b3Scalar(50.),b3Scalar(250.)));
}
m_collisionShapes.push_back(groundShape);
btTransform groundTransform;
b3Transform groundTransform;
groundTransform.setIdentity();
groundTransform.setOrigin(btVector3(0,0,0));
groundTransform.setOrigin(b3Vector3(0,0,0));
//We can also use DemoApplication::localCreateRigidBody, but for clarity it is provided here:
if (ci.m_useConcaveMesh)
{
btScalar mass(0.);
b3Scalar mass(0.);
//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);
btVector3 localInertia(0,0,0);
b3Vector3 localInertia(0,0,0);
if (isDynamic)
groundShape->calculateLocalInertia(mass,localInertia);
@@ -432,15 +432,15 @@ void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
//create a few dynamic rigidbodies
// Re-using the same collision is better for memory usage and performance
//vertices.push_back(btVector3(0,1,0));
vertices.push_back(btVector3(1,1,1));
vertices.push_back(btVector3(1,1,-1));
vertices.push_back(btVector3(-1,1,-1));
vertices.push_back(btVector3(-1,1,1));
vertices.push_back(btVector3(1,-1,1));
vertices.push_back(btVector3(1,-1,-1));
vertices.push_back(btVector3(-1,-1,-1));
vertices.push_back(btVector3(-1,-1,1));
//vertices.push_back(b3Vector3(0,1,0));
vertices.push_back(b3Vector3(1,1,1));
vertices.push_back(b3Vector3(1,1,-1));
vertices.push_back(b3Vector3(-1,1,-1));
vertices.push_back(b3Vector3(-1,1,1));
vertices.push_back(b3Vector3(1,-1,1));
vertices.push_back(b3Vector3(1,-1,-1));
vertices.push_back(b3Vector3(-1,-1,-1));
vertices.push_back(b3Vector3(-1,-1,1));
#if 1
btPolyhedralConvexShape* colShape = new btConvexHullShape(&vertices[0].getX(),vertices.size());
@@ -451,13 +451,13 @@ void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
btPolyhedralConvexShape* colShape = new btConvexHullShape(&vertices[0].getX(),vertices.size());
colShape->initializePolyhedralFeatures();
compoundShape = new btCompoundShape();
btTransform tr;
b3Transform tr;
tr.setIdentity();
tr.setOrigin(btVector3(0,-1,0));
tr.setOrigin(b3Vector3(0,-1,0));
compoundShape->addChildShape(tr,colShape);
tr.setOrigin(btVector3(0,0,2));
tr.setOrigin(b3Vector3(0,0,2));
compoundShape->addChildShape(tr,colShape);
tr.setOrigin(btVector3(2,0,0));
tr.setOrigin(b3Vector3(2,0,0));
compoundShape->addChildShape(tr,colShape);
}
btCollisionShape* colShape = compoundShape;
@@ -465,18 +465,18 @@ void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
btPolyhedralConvexShape* boxShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
btPolyhedralConvexShape* boxShape = new btBoxShape(b3Vector3(SCALING*1,SCALING*1,SCALING*1));
boxShape->initializePolyhedralFeatures();
//btCollisionShape* colShape = new btSphereShape(btScalar(1.));
//btCollisionShape* colShape = new btSphereShape(b3Scalar(1.));
m_collisionShapes.push_back(colShape);
m_collisionShapes.push_back(boxShape);
/// Create Dynamic Objects
btTransform startTransform;
b3Transform startTransform;
startTransform.setIdentity();
@@ -505,21 +505,21 @@ void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
btCollisionShape* shape = colShape;
btScalar mass = 1;
b3Scalar mass = 1;
if (!ci.m_useConcaveMesh && k==0)
mass = k==0? 0.f : 1.f;
//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);
btVector3 localInertia(0,0,0);
b3Vector3 localInertia(0,0,0);
if (isDynamic)
shape->calculateLocalInertia(mass,localInertia);
startTransform.setOrigin(SCALING*btVector3(
btScalar(startX+gapX*i + start_x),
btScalar(ci.gapY*(k+0.5) + start_y),
btScalar(startZ+gapZ*j + start_z)));
startTransform.setOrigin(SCALING*b3Vector3(
b3Scalar(startX+gapX*i + start_x),
b3Scalar(ci.gapY*(k+0.5) + start_y),
b3Scalar(startZ+gapZ*j + start_z)));
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
@@ -541,7 +541,7 @@ void GpuDemo::initPhysics(const ConstructionInfo& ci)
// setTexturing(true);
//setShadows(false);
// setCameraDistance(btScalar(SCALING*250.));
// setCameraDistance(b3Scalar(SCALING*250.));
///collision configuration contains default setup for memory, collision setup
if (ci.useOpenCL)
@@ -553,7 +553,7 @@ void GpuDemo::initPhysics(const ConstructionInfo& ci)
}
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
m_dynamicsWorld->setGravity(b3Vector3(0,-10,0));
///create a few basic rigid bodies

View File

@@ -16,7 +16,7 @@ subject to the following restrictions:
#define GPU_DEMO_H
#include "BulletCommon/btAlignedObjectArray.h"
#include "BulletCommon/b3AlignedObjectArray.h"
class btBroadphaseInterface;
@@ -41,7 +41,7 @@ protected:
btDynamicsWorld* m_dynamicsWorld;
//keep the collision shapes, for deletion/cleanup
btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
b3AlignedObjectArray<btCollisionShape*> m_collisionShapes;
float getDeltaTimeInSeconds()
{

View File

@@ -4,7 +4,7 @@
#include "OpenGLWindow/ShapeData.h"
//#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
//#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCommon/btQuickprof.h"
#include "BulletCommon/b3Quickprof.h"
/*#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btConvexPolyhedron.h"
@@ -64,20 +64,20 @@ struct GraphicsShape
GraphicsShape* createGraphicsShapeFromConvexHull(const btConvexPolyhedron* utilPtr)
{
btAlignedObjectArray<GraphicsVertex>* vertices = new btAlignedObjectArray<GraphicsVertex>;
b3AlignedObjectArray<GraphicsVertex>* vertices = new b3AlignedObjectArray<GraphicsVertex>;
{
int numVertices = utilPtr->m_vertices.size();
int numIndices = 0;
btAlignedObjectArray<int>* indicesPtr = new btAlignedObjectArray<int>;
b3AlignedObjectArray<int>* indicesPtr = new b3AlignedObjectArray<int>;
for (int f=0;f<utilPtr->m_faces.size();f++)
{
const btFace& face = utilPtr->m_faces[f];
btVector3 normal(face.m_plane[0],face.m_plane[1],face.m_plane[2]);
b3Vector3 normal(face.m_plane[0],face.m_plane[1],face.m_plane[2]);
if (face.m_indices.size()>2)
{
GraphicsVertex vtx;
const btVector3& orgVertex = utilPtr->m_vertices[face.m_indices[0]];
const b3Vector3& orgVertex = utilPtr->m_vertices[face.m_indices[0]];
vtx.xyzw[0] = orgVertex[0];vtx.xyzw[1] = orgVertex[1];vtx.xyzw[2] = orgVertex[2];vtx.xyzw[3] = 0.f;
vtx.normal[0] = normal[0];vtx.normal[1] = normal[1];vtx.normal[2] = normal[2];
vtx.uv[0] = 0.5f;vtx.uv[1] = 0.5f;
@@ -89,7 +89,7 @@ GraphicsShape* createGraphicsShapeFromConvexHull(const btConvexPolyhedron* utilP
indicesPtr->push_back(newvtxindex0);
{
GraphicsVertex vtx;
const btVector3& orgVertex = utilPtr->m_vertices[face.m_indices[j]];
const b3Vector3& orgVertex = utilPtr->m_vertices[face.m_indices[j]];
vtx.xyzw[0] = orgVertex[0];vtx.xyzw[1] = orgVertex[1];vtx.xyzw[2] = orgVertex[2];vtx.xyzw[3] = 0.f;
vtx.normal[0] = normal[0];vtx.normal[1] = normal[1];vtx.normal[2] = normal[2];
vtx.uv[0] = 0.5f;vtx.uv[1] = 0.5f;
@@ -100,7 +100,7 @@ GraphicsShape* createGraphicsShapeFromConvexHull(const btConvexPolyhedron* utilP
{
GraphicsVertex vtx;
const btVector3& orgVertex = utilPtr->m_vertices[face.m_indices[j+1]];
const b3Vector3& orgVertex = utilPtr->m_vertices[face.m_indices[j+1]];
vtx.xyzw[0] = orgVertex[0];vtx.xyzw[1] = orgVertex[1];vtx.xyzw[2] = orgVertex[2];vtx.xyzw[3] = 0.f;
vtx.normal[0] = normal[0];vtx.normal[1] = normal[1];vtx.normal[2] = normal[2];
vtx.uv[0] = 0.5f;vtx.uv[1] = 0.5f;
@@ -127,8 +127,8 @@ GraphicsShape* createGraphicsShapeFromConvexHull(const btConvexPolyhedron* utilP
GraphicsShape* createGraphicsShapeFromCompoundShape(btCompoundShape* compound)
{
GraphicsShape* gfxShape = new GraphicsShape();
btAlignedObjectArray<GraphicsVertex>* vertexArray = new btAlignedObjectArray<GraphicsVertex>;
btAlignedObjectArray<int>* indexArray = new btAlignedObjectArray<int>;
b3AlignedObjectArray<GraphicsVertex>* vertexArray = new b3AlignedObjectArray<GraphicsVertex>;
b3AlignedObjectArray<int>* indexArray = new b3AlignedObjectArray<int>;
@@ -139,7 +139,7 @@ GraphicsShape* createGraphicsShapeFromCompoundShape(btCompoundShape* compound)
if (compound->getChildShape(i)->isPolyhedral())
{
btPolyhedralConvexShape* convexHull = (btPolyhedralConvexShape*) compound->getChildShape(i);
btTransform tr = compound->getChildTransform(i);
b3Transform tr = compound->getChildTransform(i);
const btConvexPolyhedron* polyhedron = convexHull->getConvexPolyhedron();
GraphicsShape* childGfxShape = createGraphicsShapeFromConvexHull(polyhedron);
@@ -153,7 +153,7 @@ GraphicsShape* createGraphicsShapeFromCompoundShape(btCompoundShape* compound)
for (int j=0;j<childGfxShape->m_numvertices;j++)
{
GraphicsVertex vtx;
btVector3 pos(orgVerts[j].xyzw[0],orgVerts[j].xyzw[1],orgVerts[j].xyzw[2]);
b3Vector3 pos(orgVerts[j].xyzw[0],orgVerts[j].xyzw[1],orgVerts[j].xyzw[2]);
pos = tr*pos;
vtx.xyzw[0] = childGfxShape->m_scaling[0]*pos.getX();
vtx.xyzw[1] = childGfxShape->m_scaling[1]*pos.getY();
@@ -163,7 +163,7 @@ GraphicsShape* createGraphicsShapeFromCompoundShape(btCompoundShape* compound)
vtx.uv[0] = 0.5f;
vtx.uv[1] = 0.5f;
btVector3 normal(orgVerts[j].normal[0],orgVerts[j].normal[1],orgVerts[j].normal[2]);
b3Vector3 normal(orgVerts[j].normal[0],orgVerts[j].normal[1],orgVerts[j].normal[2]);
normal = tr.getBasis()*normal;
vtx.normal[0] = normal.getX();
vtx.normal[1] = normal.getY();
@@ -192,12 +192,12 @@ GraphicsShape* createGraphicsShapeFromCompoundShape(btCompoundShape* compound)
GraphicsShape* createGraphicsShapeFromConcaveMesh(const btBvhTriangleMeshShape* trimesh)
{
btAlignedObjectArray<GraphicsVertex>* vertices = new btAlignedObjectArray<GraphicsVertex>;
btAlignedObjectArray<int>* indicesPtr = new btAlignedObjectArray<int>;
b3AlignedObjectArray<GraphicsVertex>* vertices = new b3AlignedObjectArray<GraphicsVertex>;
b3AlignedObjectArray<int>* indicesPtr = new b3AlignedObjectArray<int>;
const b3StridingMeshInterface* meshInterface = trimesh->getMeshInterface();
btVector3 trimeshScaling(1,1,1);
b3Vector3 trimeshScaling(1,1,1);
for (int partId=0;partId<meshInterface->getNumSubParts();partId++)
{
@@ -211,9 +211,9 @@ GraphicsShape* createGraphicsShapeFromConcaveMesh(const btBvhTriangleMeshShape*
PHY_ScalarType indicestype = PHY_INTEGER;
//PHY_ScalarType indexType=0;
btVector3 triangleVerts[3];
b3Vector3 triangleVerts[3];
meshInterface->getLockedReadOnlyVertexIndexBase(&vertexbase,numverts, type,stride,&indexbase,indexstride,numfaces,indicestype,partId);
btVector3 aabbMin,aabbMax;
b3Vector3 aabbMin,aabbMax;
for (int triangleIndex = 0 ; triangleIndex < numfaces;triangleIndex++)
{
@@ -226,7 +226,7 @@ GraphicsShape* createGraphicsShapeFromConcaveMesh(const btBvhTriangleMeshShape*
if (type == PHY_FLOAT)
{
float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
triangleVerts[j] = btVector3(
triangleVerts[j] = b3Vector3(
graphicsbase[0]*trimeshScaling.getX(),
graphicsbase[1]*trimeshScaling.getY(),
graphicsbase[2]*trimeshScaling.getZ());
@@ -234,12 +234,12 @@ GraphicsShape* createGraphicsShapeFromConcaveMesh(const btBvhTriangleMeshShape*
else
{
double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
triangleVerts[j] = btVector3( btScalar(graphicsbase[0]*trimeshScaling.getX()),
btScalar(graphicsbase[1]*trimeshScaling.getY()),
btScalar(graphicsbase[2]*trimeshScaling.getZ()));
triangleVerts[j] = b3Vector3( b3Scalar(graphicsbase[0]*trimeshScaling.getX()),
b3Scalar(graphicsbase[1]*trimeshScaling.getY()),
b3Scalar(graphicsbase[2]*trimeshScaling.getZ()));
}
}
btVector3 normal = (triangleVerts[2]-triangleVerts[0]).cross(triangleVerts[1]-triangleVerts[0]);
b3Vector3 normal = (triangleVerts[2]-triangleVerts[0]).cross(triangleVerts[1]-triangleVerts[0]);
normal.normalize();
GraphicsVertex vtx0,vtx1,vtx2;
@@ -299,18 +299,18 @@ GraphicsShape* createGraphicsShapeFromConcaveMesh(const btBvhTriangleMeshShape*
GraphicsShape* createGraphicsShapeFromWavefrontObj(objLoader* obj)
{
btAlignedObjectArray<GraphicsVertex>* vertices = new btAlignedObjectArray<GraphicsVertex>;
b3AlignedObjectArray<GraphicsVertex>* vertices = new b3AlignedObjectArray<GraphicsVertex>;
{
// int numVertices = obj->vertexCount;
// int numIndices = 0;
btAlignedObjectArray<int>* indicesPtr = new btAlignedObjectArray<int>;
b3AlignedObjectArray<int>* indicesPtr = new b3AlignedObjectArray<int>;
/*
for (int v=0;v<obj->vertexCount;v++)
{
vtx.xyzw[0] = obj->vertexList[v]->e[0];
vtx.xyzw[1] = obj->vertexList[v]->e[1];
vtx.xyzw[2] = obj->vertexList[v]->e[2];
btVector3 n(vtx.xyzw[0],vtx.xyzw[1],vtx.xyzw[2]);
b3Vector3 n(vtx.xyzw[0],vtx.xyzw[1],vtx.xyzw[2]);
if (n.length2()>SIMD_EPSILON)
{
n.normalize();
@@ -332,10 +332,10 @@ GraphicsShape* createGraphicsShapeFromWavefrontObj(objLoader* obj)
for (int f=0;f<obj->faceCount;f++)
{
obj_face* face = obj->faceList[f];
//btVector3 normal(face.m_plane[0],face.m_plane[1],face.m_plane[2]);
//b3Vector3 normal(face.m_plane[0],face.m_plane[1],face.m_plane[2]);
if (face->vertex_count>=3)
{
btVector3 normal(0,1,0);
b3Vector3 normal(0,1,0);
int vtxBaseIndex = vertices->size();
if (face->vertex_count<=4)
@@ -366,9 +366,9 @@ GraphicsShape* createGraphicsShapeFromWavefrontObj(objLoader* obj)
vtx2.uv[1] = obj->textureList[face->vertex_index[2]]->e[1];
btVector3 v0(vtx0.xyzw[0],vtx0.xyzw[1],vtx0.xyzw[2]);
btVector3 v1(vtx1.xyzw[0],vtx1.xyzw[1],vtx1.xyzw[2]);
btVector3 v2(vtx2.xyzw[0],vtx2.xyzw[1],vtx2.xyzw[2]);
b3Vector3 v0(vtx0.xyzw[0],vtx0.xyzw[1],vtx0.xyzw[2]);
b3Vector3 v1(vtx1.xyzw[0],vtx1.xyzw[1],vtx1.xyzw[2]);
b3Vector3 v2(vtx2.xyzw[0],vtx2.xyzw[1],vtx2.xyzw[2]);
normal = (v1-v0).cross(v2-v0);
normal.normalize();
@@ -446,13 +446,13 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
{
btCollisionObject* colObj = colObjArray[i];
btVector3 pos = colObj->getWorldTransform().getOrigin();
btQuaternion orn = colObj->getWorldTransform().getRotation();
b3Vector3 pos = colObj->getWorldTransform().getOrigin();
b3Quaternion orn = colObj->getWorldTransform().getRotation();
float position[4] = {pos.getX(),pos.getY(),pos.getZ(),0.f};
float orientation[4] = {orn.getX(),orn.getY(),orn.getZ(),orn.getW()};
float color[4] = {0,0,0,1};
btVector3 localScaling = colObj->getCollisionShape()->getLocalScaling();
b3Vector3 localScaling = colObj->getCollisionShape()->getLocalScaling();
if (colObj->isStaticOrKinematicObject())
@@ -476,7 +476,7 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
prevGraphicsShapeIndex = renderer.registerShape(&gfxShape->m_vertices[0],gfxShape->m_numvertices,gfxShape->m_indices,gfxShape->m_numIndices);
prevShape = colObj->getCollisionShape();
const btVector3& scaling = prevShape->getLocalScaling();
const b3Vector3& scaling = prevShape->getLocalScaling();
localScaling[0] = scaling.getX();localScaling[1] = scaling.getY();localScaling[2] = scaling.getZ();
} else
{
@@ -486,7 +486,7 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
GraphicsShape* gfxShape = createGraphicsShapeFromConcaveMesh(trimesh);
prevGraphicsShapeIndex = renderer.registerShape(&gfxShape->m_vertices[0],gfxShape->m_numvertices,gfxShape->m_indices,gfxShape->m_numIndices);
prevShape = colObj->getCollisionShape();
const btVector3& scaling = prevShape->getLocalScaling();
const b3Vector3& scaling = prevShape->getLocalScaling();
localScaling[0] = scaling.getX();localScaling[1] = scaling.getY();localScaling[2] = scaling.getZ();
} else
{
@@ -498,7 +498,7 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
{
prevGraphicsShapeIndex = renderer.registerShape(&gfxShape->m_vertices[0],gfxShape->m_numvertices,gfxShape->m_indices,gfxShape->m_numIndices);
prevShape = colObj->getCollisionShape();
const btVector3& scaling = prevShape->getLocalScaling();
const b3Vector3& scaling = prevShape->getLocalScaling();
localScaling[0] = scaling.getX();localScaling[1] = scaling.getY();localScaling[2] = scaling.getZ();
} else
{
@@ -509,7 +509,7 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
if (colObj->getCollisionShape()->getShapeType()==SPHERE_SHAPE_PROXYTYPE)
{
btSphereShape* sphere = (btSphereShape*) colObj->getCollisionShape();
btScalar radius = sphere->getRadius();
b3Scalar radius = sphere->getRadius();
//btConvexHullShape* spherePoly = new btConvexHullShape(
//const btConvexPolyhedron* pol = polyShape->getConvexPolyhedron();
@@ -589,7 +589,7 @@ void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOn
}
}
prevShape = sphere;
const btVector3& scaling = prevShape->getLocalScaling();
const b3Vector3& scaling = prevShape->getLocalScaling();
//assume uniform scaling, using X component
float sphereScale = radius*scaling.getX();
localScaling[0] = sphereScale;

View File

@@ -9,7 +9,7 @@
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
#include "LinearMath/btQuickprof.h"
#include "LinearMath/b3Quickprof.h"
#ifdef _WIN32
@@ -43,7 +43,7 @@ void btGpuDynamicsWorld::exitOpenCL()
int btGpuDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps, btScalar fixedTimeStep)
int btGpuDynamicsWorld::stepSimulation( b3Scalar timeStep,int maxSubSteps, b3Scalar fixedTimeStep)
{
#ifndef BT_NO_PROFILE
// CProfileManager::Reset();
@@ -73,10 +73,10 @@ int btGpuDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps, btSc
BT_PROFILE("scatter transforms into rigidbody (CPU)");
for (int i=0;i<this->m_collisionObjects.size();i++)
{
btVector3 pos;
btQuaternion orn;
b3Vector3 pos;
b3Quaternion orn;
m_gpuPhysics->getObjectTransformFromCpu(&pos[0],&orn[0],i);
btTransform newTrans;
b3Transform newTrans;
newTrans.setOrigin(pos);
newTrans.setRotation(orn);
this->m_collisionObjects[i]->setWorldTransform(newTrans);
@@ -94,7 +94,7 @@ int btGpuDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps, btSc
}
void btGpuDynamicsWorld::setGravity(const btVector3& gravity)
void btGpuDynamicsWorld::setGravity(const b3Vector3& gravity)
{
}
@@ -110,8 +110,8 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
btPolyhedralConvexShape* convex = (btPolyhedralConvexShape*)colShape;
int numVertices=convex->getNumVertices();
int strideInBytes=sizeof(btVector3);
btAlignedObjectArray<btVector3> tmpVertices;
int strideInBytes=sizeof(b3Vector3);
b3AlignedObjectArray<b3Vector3> tmpVertices;
tmpVertices.resize(numVertices);
for (int i=0;i<numVertices;i++)
convex->getVertex(i,tmpVertices[i]);
@@ -128,10 +128,10 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*) colShape;
b3StridingMeshInterface* meshInterface = trimesh->getMeshInterface();
btAlignedObjectArray<btVector3> vertices;
btAlignedObjectArray<int> indices;
b3AlignedObjectArray<b3Vector3> vertices;
b3AlignedObjectArray<int> indices;
btVector3 trimeshScaling(1,1,1);
b3Vector3 trimeshScaling(1,1,1);
for (int partId=0;partId<meshInterface->getNumSubParts();partId++)
{
@@ -145,9 +145,9 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
PHY_ScalarType indicestype = PHY_INTEGER;
//PHY_ScalarType indexType=0;
btVector3 triangleVerts[3];
b3Vector3 triangleVerts[3];
meshInterface->getLockedReadOnlyVertexIndexBase(&vertexbase,numverts, type,stride,&indexbase,indexstride,numfaces,indicestype,partId);
btVector3 aabbMin,aabbMax;
b3Vector3 aabbMin,aabbMax;
for (int triangleIndex = 0 ; triangleIndex < numfaces;triangleIndex++)
{
@@ -160,7 +160,7 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
if (type == PHY_FLOAT)
{
float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
triangleVerts[j] = btVector3(
triangleVerts[j] = b3Vector3(
graphicsbase[0]*trimeshScaling.getX(),
graphicsbase[1]*trimeshScaling.getY(),
graphicsbase[2]*trimeshScaling.getZ());
@@ -168,9 +168,9 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
else
{
double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
triangleVerts[j] = btVector3( btScalar(graphicsbase[0]*trimeshScaling.getX()),
btScalar(graphicsbase[1]*trimeshScaling.getY()),
btScalar(graphicsbase[2]*trimeshScaling.getZ()));
triangleVerts[j] = b3Vector3( b3Scalar(graphicsbase[0]*trimeshScaling.getX()),
b3Scalar(graphicsbase[1]*trimeshScaling.getY()),
b3Scalar(graphicsbase[2]*trimeshScaling.getZ()));
}
}
vertices.push_back(triangleVerts[0]);
@@ -207,7 +207,7 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
{
btCompoundShape* compound = (btCompoundShape*) colShape;
btAlignedObjectArray<btGpuChildShape> childShapes;
b3AlignedObjectArray<btGpuChildShape> childShapes;
for (int i=0;i<compound->getNumChildShapes();i++)
{
@@ -215,8 +215,8 @@ int btGpuDynamicsWorld::findOrRegisterCollisionShape(const btCollisionShape* col
btAssert(compound->getChildShape(i)->isPolyhedral());
btGpuChildShape child;
child.m_shapeIndex = findOrRegisterCollisionShape(compound->getChildShape(i));
btVector3 pos = compound->getChildTransform(i).getOrigin();
btQuaternion orn = compound->getChildTransform(i).getRotation();
b3Vector3 pos = compound->getChildTransform(i).getOrigin();
b3Quaternion orn = compound->getChildTransform(i).getRotation();
for (int v=0;v<4;v++)
{
child.m_childPosition[v] = pos[v];
@@ -283,8 +283,8 @@ void btGpuDynamicsWorld::addRigidBody(btRigidBody* body)
{
int gpuShapeIndex= m_uniqueShapeMapping[index];
float mass = body->getInvMass() ? 1.f/body->getInvMass() : 0.f;
btVector3 pos = body->getWorldTransform().getOrigin();
btQuaternion orn = body->getWorldTransform().getRotation();
b3Vector3 pos = body->getWorldTransform().getOrigin();
b3Quaternion orn = body->getWorldTransform().getRotation();
m_gpuPhysics->registerPhysicsInstance(mass,&pos.getX(),&orn.getX(),gpuShapeIndex,m_collisionObjects.size());

View File

@@ -1,25 +1,25 @@
#ifndef BT_GPU_DYNAMICS_WORLD_H
#define BT_GPU_DYNAMICS_WORLD_H
class btVector3;
class b3Vector3;
class btRigidBody;
class btCollisionObject;
struct btGpuInternalData;//use this struct to avoid 'leaking' all OpenCL headers into clients code base
class CLPhysicsDemo;
#include "BulletCommon/btAlignedObjectArray.h"
#include "BulletCommon/b3AlignedObjectArray.h"
//#include "BulletDynamics/Dynamics/btDynamicsWorld.h"
class btGpuDynamicsWorld //: public btDynamicsWorld
{
btAlignedObjectArray<const class btCollisionShape*> m_uniqueShapes;
btAlignedObjectArray<int> m_uniqueShapeMapping;
b3AlignedObjectArray<const class btCollisionShape*> m_uniqueShapes;
b3AlignedObjectArray<int> m_uniqueShapeMapping;
CLPhysicsDemo* m_gpuPhysics;
btVector3 m_gravity;
b3Vector3 m_gravity;
bool m_once;
bool initOpenCL(int preferredDeviceIndex, int preferredPlatformIndex, bool useInterop);
@@ -33,7 +33,7 @@ public:
virtual ~btGpuDynamicsWorld();
virtual int stepSimulation( btScalar timeStep,int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.));
virtual int stepSimulation( b3Scalar timeStep,int maxSubSteps=1, b3Scalar fixedTimeStep=b3Scalar(1.)/b3Scalar(60.));
virtual void synchronizeMotionStates()
{
@@ -42,7 +42,7 @@ public:
void debugDrawWorld() {}
void setGravity(const btVector3& gravity);
void setGravity(const b3Vector3& gravity);
void addRigidBody(btRigidBody* body);
@@ -50,9 +50,9 @@ public:
btAlignedObjectArray<class btCollisionObject*>& getCollisionObjectArray();
b3AlignedObjectArray<class btCollisionObject*>& getCollisionObjectArray();
const btAlignedObjectArray<class btCollisionObject*>& getCollisionObjectArray() const;
const b3AlignedObjectArray<class btCollisionObject*>& getCollisionObjectArray() const;
virtual void addAction(btActionInterface* action)
{
@@ -65,7 +65,7 @@ public:
}
btVector3 getGravity () const
b3Vector3 getGravity () const
{
return m_gravity;
}

View File

@@ -1,6 +1,6 @@
#include "GpuDemo.h"
#include "GpuDemoInternalData.h"
#include "BulletCommon/btScalar.h"
#include "BulletCommon/b3Scalar.h"
#include "basic_initialize/b3OpenCLUtils.h"
#include "OpenGLWindow/ShapeData.h"
#include "OpenGLWindow/GLInstancingRenderer.h"

View File

@@ -38,9 +38,9 @@ public:
:useOpenCL(true),
preferredOpenCLPlatformIndex(-1),
preferredOpenCLDeviceIndex(-1),
arraySizeX(10),
arraySizeX(30),
arraySizeY(30),
arraySizeZ(10),
arraySizeZ(30),
m_useConcaveMesh(false),
gapX(14.3),
gapY(14.0),

View File

@@ -9,7 +9,7 @@ static char* particleKernelsString =
#include "ParticleKernels.cl"
#define INTEROPKERNEL_SRC_PATH "demo/gpudemo/ParticleKernels.cl"
#include "BulletCommon/btVector3.h"
#include "BulletCommon/b3Vector3.h"
#include "OpenGLWindow/OpenGLInclude.h"
#include "OpenGLWindow/GLInstanceRendererInternalData.h"
#include "parallel_primitives/host/btLauncherCL.h"
@@ -19,7 +19,7 @@ static char* particleKernelsString =
#include "GpuDemoInternalData.h"
#include "BulletCommon/btQuickprof.h"
#include "BulletCommon/b3Quickprof.h"
//1000000 particles
//#define NUM_PARTICLES_X 100
@@ -46,7 +46,7 @@ static char* particleKernelsString =
ATTRIBUTE_ALIGNED16(struct) btSimParams
{
BT_DECLARE_ALIGNED_ALLOCATOR();
btVector3 m_gravity;
b3Vector3 m_gravity;
float m_worldMin[4];
float m_worldMax[4];
@@ -97,10 +97,10 @@ struct ParticleInternalData
cl_mem m_clPositionBuffer;
btAlignedObjectArray<btVector3> m_velocitiesCPU;
btOpenCLArray<btVector3>* m_velocitiesGPU;
b3AlignedObjectArray<b3Vector3> m_velocitiesCPU;
btOpenCLArray<b3Vector3>* m_velocitiesGPU;
btAlignedObjectArray<btSimParams> m_simParamCPU;
b3AlignedObjectArray<btSimParams> m_simParamCPU;
btOpenCLArray<btSimParams>* m_simParamGPU;
@@ -168,14 +168,14 @@ void ParticleDemo::setupScene(const ConstructionInfo& ci)
int maxPairsSmallProxy = 32;
float radius = 3.f*m_data->m_simParamCPU[0].m_particleRad;
m_data->m_broadphaseGPU = new b3GpuSapBroadphase(m_clData->m_clContext ,m_clData->m_clDevice,m_clData->m_clQueue);//overlappingPairCache,btVector3(4.f, 4.f, 4.f), 128, 128, 128,maxObjects, maxObjects, maxPairsSmallProxy, 100.f, 128,
m_data->m_broadphaseGPU = new b3GpuSapBroadphase(m_clData->m_clContext ,m_clData->m_clDevice,m_clData->m_clQueue);//overlappingPairCache,b3Vector3(4.f, 4.f, 4.f), 128, 128, 128,maxObjects, maxObjects, maxPairsSmallProxy, 100.f, 128,
/*m_data->m_broadphaseGPU = new btGridBroadphaseCl(overlappingPairCache,btVector3(radius,radius,radius), 128, 128, 128,
/*m_data->m_broadphaseGPU = new btGridBroadphaseCl(overlappingPairCache,b3Vector3(radius,radius,radius), 128, 128, 128,
maxObjects, maxObjects, maxPairsSmallProxy, 100.f, 128,
m_clData->m_clContext ,m_clData->m_clDevice,m_clData->m_clQueue);
*/
m_data->m_velocitiesGPU = new btOpenCLArray<btVector3>(m_clData->m_clContext,m_clData->m_clQueue,numParticles);
m_data->m_velocitiesGPU = new btOpenCLArray<b3Vector3>(m_clData->m_clContext,m_clData->m_clQueue,numParticles);
m_data->m_velocitiesCPU.resize(numParticles);
for (int i=0;i<numParticles;i++)
{
@@ -243,11 +243,11 @@ void ParticleDemo::setupScene(const ConstructionInfo& ci)
void* userPtr = (void*)userIndex;
int collidableIndex = userIndex;
btVector3 aabbMin,aabbMax;
btVector3 particleRadius(rad,rad,rad);
b3Vector3 aabbMin,aabbMax;
b3Vector3 particleRadius(rad,rad,rad);
aabbMin = btVector3(position[0],position[1],position[2])-particleRadius;
aabbMax = btVector3(position[0],position[1],position[2])+particleRadius;
aabbMin = b3Vector3(position[0],position[1],position[2])-particleRadius;
aabbMax = b3Vector3(position[0],position[1],position[2])+particleRadius;
m_data->m_broadphaseGPU->createProxy(aabbMin,aabbMax,collidableIndex,1,1);
userIndex++;

View File

@@ -1,8 +1,8 @@
#include "PairBench.h"
#include "BulletCommon/btQuickprof.h"
#include "BulletCommon/b3Quickprof.h"
#include "OpenGLWindow/ShapeData.h"
#include "OpenGLWindow/GLInstancingRenderer.h"
#include "BulletCommon/btQuaternion.h"
#include "BulletCommon/b3Quaternion.h"
#include "OpenGLWindow/btgWindowInterface.h"
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
#include "../GpuDemoInternalData.h"
@@ -187,16 +187,16 @@ void PairBench::initPhysics(const ConstructionInfo& ci)
{
for (int k=0;k<ci.arraySizeZ;k++)
{
btVector3 position(k*3,i*3,j*3);
btQuaternion orn(0,0,0,1);
b3Vector3 position(k*3,i*3,j*3);
b3Quaternion orn(0,0,0,1);
btVector4 color(0,1,0,1);
btVector4 scaling(1,1,1,1);
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
btVector3 aabbHalfExtents(1,1,1);
b3Vector3 aabbHalfExtents(1,1,1);
btVector3 aabbMin = position-aabbHalfExtents;
btVector3 aabbMax = position+aabbHalfExtents;
b3Vector3 aabbMin = position-aabbHalfExtents;
b3Vector3 aabbMax = position+aabbHalfExtents;
m_data->m_broadphaseGPU->createProxy(aabbMin,aabbMax,index,group,mask);
@@ -264,7 +264,7 @@ void PairBench::clientMoveAndDisplay()
m_data->m_instancePosOrnColor->copyFromHostPointer(positions,3*numObjects,0);
m_data->m_bodyTimes = new btOpenCLArray<float>(m_clData->m_clContext,m_clData->m_clQueue);
m_data->m_bodyTimes ->resize(numObjects);
btAlignedObjectArray<float> tmp;
b3AlignedObjectArray<float> tmp;
tmp.resize(numObjects);
for (int i=0;i<numObjects;i++)
{

View File

@@ -15,7 +15,7 @@
#include "Gwen/Controls/MenuStrip.h"
#include "Gwen/Controls/Property/Text.h"
#include "Gwen/Controls/SplitterBar.h"
#include "BulletCommon/btAlignedObjectArray.h"
#include "BulletCommon/b3AlignedObjectArray.h"
#include "Gwen/Gwen.h"
#include "Gwen/Align.h"
#include "Gwen/Utility.h"
@@ -38,7 +38,7 @@ struct GwenInternalData
Gwen::Controls::Label* m_rightStatusBar;
Gwen::Controls::Label* m_leftStatusBar;
btAlignedObjectArray<struct Gwen::Event::Handler*> m_handlers;
b3AlignedObjectArray<struct Gwen::Event::Handler*> m_handlers;
btToggleButtonCallback m_toggleButtonCallback;
btComboBoxCallback m_comboBoxCallback;

View File

@@ -16,7 +16,7 @@
#include "OpenGLWindow/GLPrimitiveRenderer.h"
#include "OpenGLWindow/GLInstancingRenderer.h"
//#include "OpenGL3CoreRenderer.h"
#include "BulletCommon/btQuickprof.h"
#include "BulletCommon/b3Quickprof.h"
//#include "btGpuDynamicsWorld.h"
#include <assert.h>
#include <string.h>
@@ -61,7 +61,7 @@ enum
MYCOMBOBOX1 = 1,
};
btAlignedObjectArray<const char*> demoNames;
b3AlignedObjectArray<const char*> demoNames;
int selectedDemo = 0;
GpuDemo::CreateFunc* allDemos[]=
{
@@ -313,7 +313,7 @@ sth_stash* initFont(GLPrimitiveRenderer* primRender)
#include "OpenGLWindow/OpenGLInclude.h"
#include "BulletCommon/CommandLineArgs.h"
#include "BulletCommon/b3CommandLineArgs.h"
void Usage()
{
@@ -383,18 +383,18 @@ void DumpSimulationTime(FILE* f)
///extern const char* g_deviceName;
const char* g_deviceName = "blaat";
extern bool useNewBatchingKernel;
#include "BulletCommon/btVector3.h"
#include "BulletCommon/b3Vector3.h"
int main(int argc, char* argv[])
{
btVector3 test(1,2,3);
b3Vector3 test(1,2,3);
test.x = 1;
test.y = 4;
printf("main start");
CommandLineArgs args(argc,argv);
b3CommandLineArgs args(argc,argv);
ParticleDemo::ConstructionInfo ci;
if (args.CheckCmdLineFlag("help"))
@@ -670,7 +670,7 @@ int main(int argc, char* argv[])
/*if (demo->getDynamicsWorld() && demo->getDynamicsWorld()->getNumCollisionObjects())
{
BT_PROFILE("renderPhysicsWorld");
btAlignedObjectArray<btCollisionObject*> arr = demo->getDynamicsWorld()->getCollisionObjectArray();
b3AlignedObjectArray<btCollisionObject*> arr = demo->getDynamicsWorld()->getCollisionObjectArray();
btCollisionObject** colObjArray = &arr[0];
render.renderPhysicsWorld(demo->getDynamicsWorld()->getNumCollisionObjects(),colObjArray, syncOnly);

View File

@@ -41,10 +41,10 @@ function createProject(vendor)
"../ObjLoader/list.cpp",
"../ObjLoader/list.h",
"../../src/BulletCommon/btAlignedAllocator.cpp",
"../../src/BulletCommon/btAlignedAllocator.h",
"../../src/BulletCommon/btQuickprof.cpp",
"../../src/BulletCommon/btQuickprof.h",
"../../src/BulletCommon/b3AlignedAllocator.cpp",
"../../src/BulletCommon/b3AlignedAllocator.h",
"../../src/BulletCommon/b3Quickprof.cpp",
"../../src/BulletCommon/b3Quickprof.h",
"../../src/BulletGeometry/btConvexHullComputer.cpp",
"../../src/BulletGeometry/btConvexHullComputer.h",

View File

@@ -1,10 +1,10 @@
#include "ConcaveScene.h"
#include "GpuRigidBodyDemo.h"
#include "BulletCommon/btQuickprof.h"
#include "BulletCommon/b3Quickprof.h"
#include "OpenGLWindow/ShapeData.h"
#include "OpenGLWindow/GLInstancingRenderer.h"
#include "BulletCommon/btQuaternion.h"
#include "BulletCommon/b3Quaternion.h"
#include "OpenGLWindow/btgWindowInterface.h"
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
#include "../GpuDemoInternalData.h"
@@ -17,7 +17,7 @@
#include "gpu_rigidbody/host/b3Config.h"
#include "GpuRigidBodyDemoInternalData.h"
#include"../../ObjLoader/objLoader.h"
#include "BulletCommon/btTransform.h"
#include "BulletCommon/b3Transform.h"
#include "OpenGLWindow/GLInstanceGraphicsShape.h"
#define CONCAVE_GAPX 16
@@ -27,18 +27,18 @@
GLInstanceGraphicsShape* createGraphicsShapeFromWavefrontObj(objLoader* obj)
{
btAlignedObjectArray<GLInstanceVertex>* vertices = new btAlignedObjectArray<GLInstanceVertex>;
b3AlignedObjectArray<GLInstanceVertex>* vertices = new b3AlignedObjectArray<GLInstanceVertex>;
{
// int numVertices = obj->vertexCount;
// int numIndices = 0;
btAlignedObjectArray<int>* indicesPtr = new btAlignedObjectArray<int>;
b3AlignedObjectArray<int>* indicesPtr = new b3AlignedObjectArray<int>;
/*
for (int v=0;v<obj->vertexCount;v++)
{
vtx.xyzw[0] = obj->vertexList[v]->e[0];
vtx.xyzw[1] = obj->vertexList[v]->e[1];
vtx.xyzw[2] = obj->vertexList[v]->e[2];
btVector3 n(vtx.xyzw[0],vtx.xyzw[1],vtx.xyzw[2]);
b3Vector3 n(vtx.xyzw[0],vtx.xyzw[1],vtx.xyzw[2]);
if (n.length2()>SIMD_EPSILON)
{
n.normalize();
@@ -60,10 +60,10 @@ GLInstanceGraphicsShape* createGraphicsShapeFromWavefrontObj(objLoader* obj)
for (int f=0;f<obj->faceCount;f++)
{
obj_face* face = obj->faceList[f];
//btVector3 normal(face.m_plane[0],face.m_plane[1],face.m_plane[2]);
//b3Vector3 normal(face.m_plane[0],face.m_plane[1],face.m_plane[2]);
if (face->vertex_count>=3)
{
btVector3 normal(0,1,0);
b3Vector3 normal(0,1,0);
int vtxBaseIndex = vertices->size();
if (face->vertex_count<=4)
@@ -98,9 +98,9 @@ GLInstanceGraphicsShape* createGraphicsShapeFromWavefrontObj(objLoader* obj)
vtx2.uv[1] = 0.5f;obj->textureList[face->vertex_index[2]]->e[1];
btVector3 v0(vtx0.xyzw[0],vtx0.xyzw[1],vtx0.xyzw[2]);
btVector3 v1(vtx1.xyzw[0],vtx1.xyzw[1],vtx1.xyzw[2]);
btVector3 v2(vtx2.xyzw[0],vtx2.xyzw[1],vtx2.xyzw[2]);
b3Vector3 v0(vtx0.xyzw[0],vtx0.xyzw[1],vtx0.xyzw[2]);
b3Vector3 v1(vtx1.xyzw[0],vtx1.xyzw[1],vtx1.xyzw[2]);
b3Vector3 v2(vtx2.xyzw[0],vtx2.xyzw[1],vtx2.xyzw[2]);
normal = (v1-v0).cross(v2-v0);
normal.normalize();
@@ -168,7 +168,7 @@ void ConcaveScene::createConcaveMesh(const ConstructionInfo& ci)
char* fileName = "data/samurai_monastry.obj";
// char* fileName = "data/teddy2_VHACD_CHs.obj";
btVector3 shift(0,0,0);//0,230,80);//150,-100,-120);
b3Vector3 shift(0,0,0);//0,230,80);//150,-100,-120);
btVector4 scaling(4,4,4,1);
FILE* f = 0;
@@ -202,19 +202,19 @@ void ConcaveScene::createConcaveMesh(const ConstructionInfo& ci)
GLInstanceGraphicsShape* shape = createGraphicsShapeFromWavefrontObj(objData);
btAlignedObjectArray<btVector3> verts;
b3AlignedObjectArray<b3Vector3> verts;
for (int i=0;i<shape->m_numvertices;i++)
{
for (int j=0;j<3;j++)
shape->m_vertices->at(i).xyzw[j] += shift[j];
btVector3 vtx(shape->m_vertices->at(i).xyzw[0],
b3Vector3 vtx(shape->m_vertices->at(i).xyzw[0],
shape->m_vertices->at(i).xyzw[1],
shape->m_vertices->at(i).xyzw[2]);
verts.push_back(vtx*scaling);
}
int colIndex = m_data->m_np->registerConcaveMesh(&verts,shape->m_indices,btVector3(1,1,1));
int colIndex = m_data->m_np->registerConcaveMesh(&verts,shape->m_indices,b3Vector3(1,1,1));
{
int strideInBytes = 9*sizeof(float);
@@ -225,14 +225,14 @@ void ConcaveScene::createConcaveMesh(const ConstructionInfo& ci)
int shapeId = ci.m_instancingRenderer->registerShape(&shape->m_vertices->at(0).xyzw[0], shape->m_numvertices, &shape->m_indices->at(0), shape->m_numIndices);
btQuaternion orn(0,0,0,1);
b3Quaternion orn(0,0,0,1);
btVector4 color(0.3,0.3,1,1.f);//0.5);//1.f
{
float mass = 0.f;
btVector3 position(0,0,0);
b3Vector3 position(0,0,0);
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index);
index++;
@@ -267,8 +267,8 @@ void ConcaveScene::setupScene(const ConstructionInfo& ci)
{
btVector4 scaling(400,0.001,400,1);
int colIndex = m_data->m_np->registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
btVector3 position(0,-2,0);
btQuaternion orn(0,0,0,1);
b3Vector3 position(0,-2,0);
b3Quaternion orn(0,0,0,1);
btVector4 color(0,0,1,1);
@@ -323,9 +323,9 @@ void ConcaveScene::createDynamicObjects(const ConstructionInfo& ci)
{
float mass = 1;
//btVector3 position(-2*ci.gapX+i*ci.gapX,25+j*ci.gapY,-2*ci.gapZ+k*ci.gapZ);
btVector3 position(-(ci.arraySizeX/2)*CONCAVE_GAPX+i*CONCAVE_GAPX,150+j*CONCAVE_GAPY,-(ci.arraySizeZ/2)*CONCAVE_GAPZ+k*CONCAVE_GAPZ);
btQuaternion orn(0,0,0,1);
//b3Vector3 position(-2*ci.gapX+i*ci.gapX,25+j*ci.gapY,-2*ci.gapZ+k*ci.gapZ);
b3Vector3 position(-(ci.arraySizeX/2)*CONCAVE_GAPX+i*CONCAVE_GAPX,150+j*CONCAVE_GAPY,-(ci.arraySizeZ/2)*CONCAVE_GAPZ+k*CONCAVE_GAPZ);
b3Quaternion orn(0,0,0,1);
btVector4 color = colors[curColor];
curColor++;
@@ -363,7 +363,7 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
//char* fileName = "data/cube_offset.obj";
btVector3 shift(0,0,0);//0,230,80);//150,-100,-120);
b3Vector3 shift(0,0,0);//0,230,80);//150,-100,-120);
btVector4 scaling(1,1,1,1);
FILE* f = 0;
@@ -398,8 +398,8 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
int strideInBytes = 9*sizeof(float);
btAlignedObjectArray<GLInstanceVertex> vertexArray;
btAlignedObjectArray<int> indexArray;
b3AlignedObjectArray<GLInstanceVertex> vertexArray;
b3AlignedObjectArray<int> indexArray;
@@ -410,14 +410,14 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
int index=0;
int colIndex = 0;
btAlignedObjectArray<GLInstanceVertex> vertices;
b3AlignedObjectArray<GLInstanceVertex> vertices;
int stride2 = sizeof(GLInstanceVertex);
btAssert(stride2 == strideInBytes);
{
btAlignedObjectArray<btGpuChildShape> childShapes;
b3AlignedObjectArray<btGpuChildShape> childShapes;
int numChildShapes = objData->objectCount;
@@ -435,15 +435,15 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
//for now, only support polyhedral child shapes
btGpuChildShape child;
btVector3 pos(0,0,0);
btQuaternion orn(0,0,0,1);
b3Vector3 pos(0,0,0);
b3Quaternion orn(0,0,0,1);
for (int v=0;v<4;v++)
{
child.m_childPosition[v] = pos[v];
child.m_childOrientation[v] = orn[v];
}
btTransform tr;
b3Transform tr;
tr.setIdentity();
tr.setOrigin(pos);
tr.setRotation(orn);
@@ -465,11 +465,11 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
}
}
btVector3 center(0,0,0);
b3Vector3 center(0,0,0);
btAlignedObjectArray<GLInstanceVertex> tmpVertices;
b3AlignedObjectArray<GLInstanceVertex> tmpVertices;
//add transformed graphics vertices and indices
btVector3 myScaling(1,1,1);//50,50,50);//300,300,300);
b3Vector3 myScaling(1,1,1);//50,50,50);//300,300,300);
for (int v=0;v<numVertices;v++)
{
GLInstanceVertex vert;
@@ -479,7 +479,7 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
vert.normal[0]=0.f;
vert.normal[1]=1.f;
vert.normal[2]=0.f;
btVector3 vertPos;
b3Vector3 vertPos;
vertPos[0] = orgVert->e[0]*myScaling[0];
vertPos[1] = orgVert->e[1]*myScaling[1];
vertPos[2] = orgVert->e[2]*myScaling[2];
@@ -498,7 +498,7 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
vert.normal[0]=0.f;
vert.normal[1]=1.f;
vert.normal[2]=0.f;
btVector3 vertPos;
b3Vector3 vertPos;
vertPos[0] = orgVert->e[0]*myScaling[0];
vertPos[1] = orgVert->e[1]*myScaling[1];
vertPos[2] = orgVert->e[2]*myScaling[2];
@@ -509,7 +509,7 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
vert.xyzw[2] = vertPos[2];
tmpVertices.push_back(vert);
btVector3 newPos = tr*vertPos;
b3Vector3 newPos = tr*vertPos;
vert.xyzw[0] = newPos[0];
vert.xyzw[1] = newPos[1];
vert.xyzw[2] = newPos[2];
@@ -548,11 +548,11 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
{
float mass = 1;//j==0? 0.f : 1.f;
//btVector3 position(i*10*ci.gapX,j*ci.gapY,k*10*ci.gapZ);
btVector3 position(i*10*ci.gapX,50+j*ci.gapY,k*10*ci.gapZ);
//b3Vector3 position(i*10*ci.gapX,j*ci.gapY,k*10*ci.gapZ);
b3Vector3 position(i*10*ci.gapX,50+j*ci.gapY,k*10*ci.gapZ);
// btQuaternion orn(0,0,0,1);
btQuaternion orn(btVector3(0,0,1),1.8);
// b3Quaternion orn(0,0,0,1);
b3Quaternion orn(b3Vector3(0,0,1),1.8);
btVector4 color = colors[curColor];
curColor++;
@@ -577,8 +577,8 @@ void ConcaveCompoundScene::createDynamicObjects(const ConstructionInfo& ci)
int numVertices = sizeof(cube_vertices)/strideInBytes;
int numIndices = sizeof(cube_indices)/sizeof(int);
btAlignedObjectArray<GLInstanceVertex> vertexArray;
btAlignedObjectArray<int> indexArray;
b3AlignedObjectArray<GLInstanceVertex> vertexArray;
b3AlignedObjectArray<int> indexArray;
//int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
@@ -596,28 +596,28 @@ void ConcaveCompoundScene::createDynamicObjects(const ConstructionInfo& ci)
int childColIndex = m_data->m_np->registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
btVector3 childPositions[3] = {
btVector3(0,-2,0),
btVector3(0,0,0),
btVector3(0,0,2)
b3Vector3 childPositions[3] = {
b3Vector3(0,-2,0),
b3Vector3(0,0,0),
b3Vector3(0,0,2)
};
btAlignedObjectArray<btGpuChildShape> childShapes;
b3AlignedObjectArray<btGpuChildShape> childShapes;
int numChildShapes = 3;
for (int i=0;i<numChildShapes;i++)
{
//for now, only support polyhedral child shapes
btGpuChildShape child;
child.m_shapeIndex = childColIndex;
btVector3 pos = childPositions[i];
btQuaternion orn(0,0,0,1);
b3Vector3 pos = childPositions[i];
b3Quaternion orn(0,0,0,1);
for (int v=0;v<4;v++)
{
child.m_childPosition[v] = pos[v];
child.m_childOrientation[v] = orn[v];
}
childShapes.push_back(child);
btTransform tr;
b3Transform tr;
tr.setIdentity();
tr.setOrigin(pos);
tr.setRotation(orn);
@@ -630,8 +630,8 @@ btVector3 childPositions[3] = {
for (int v=0;v<numVertices;v++)
{
GLInstanceVertex vert = cubeVerts[v];
btVector3 vertPos(vert.xyzw[0],vert.xyzw[1],vert.xyzw[2]);
btVector3 newPos = tr*vertPos;
b3Vector3 vertPos(vert.xyzw[0],vert.xyzw[1],vert.xyzw[2]);
b3Vector3 newPos = tr*vertPos;
vert.xyzw[0] = newPos[0];
vert.xyzw[1] = newPos[1];
vert.xyzw[2] = newPos[2];
@@ -665,9 +665,9 @@ btVector3 childPositions[3] = {
{
float mass = 1;//j==0? 0.f : 1.f;
btVector3 position(i*ci.gapX,150+j*ci.gapY,k*ci.gapZ);
//btQuaternion orn(0,0,0,1);
btQuaternion orn(btVector3(1,0,0),0.7);
b3Vector3 position(i*ci.gapX,150+j*ci.gapY,k*ci.gapZ);
//b3Quaternion orn(0,0,0,1);
b3Quaternion orn(b3Vector3(1,0,0),0.7);
btVector4 color = colors[curColor];
curColor++;
@@ -722,11 +722,11 @@ void ConcaveSphereScene::createDynamicObjects(const ConstructionInfo& ci)
float mass = 1.f;
btVector3 position(-(ci.arraySizeX/2)*8+i*8,50+j*8,-(ci.arraySizeZ/2)*8+k*8);
b3Vector3 position(-(ci.arraySizeX/2)*8+i*8,50+j*8,-(ci.arraySizeZ/2)*8+k*8);
//btVector3 position(0,-41,0);//0,0,0);//i*radius*3,-41+j*radius*3,k*radius*3);
//b3Vector3 position(0,-41,0);//0,0,0);//i*radius*3,-41+j*radius*3,k*radius*3);
btQuaternion orn(0,0,0,1);
b3Quaternion orn(0,0,0,1);
btVector4 color = colors[curColor];
curColor++;

View File

@@ -1,10 +1,10 @@
#include "GpuCompoundScene.h"
#include "GpuRigidBodyDemo.h"
#include "BulletCommon/btQuickprof.h"
#include "BulletCommon/b3Quickprof.h"
#include "OpenGLWindow/ShapeData.h"
#include "OpenGLWindow/GLInstancingRenderer.h"
#include "BulletCommon/btQuaternion.h"
#include "BulletCommon/b3Quaternion.h"
#include "OpenGLWindow/btgWindowInterface.h"
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
#include "../GpuDemoInternalData.h"
@@ -16,7 +16,7 @@
#include "gpu_rigidbody/host/b3GpuNarrowPhase.h"
#include "gpu_rigidbody/host/b3Config.h"
#include "GpuRigidBodyDemoInternalData.h"
#include "BulletCommon/btTransform.h"
#include "BulletCommon/b3Transform.h"
#include "OpenGLWindow/GLInstanceGraphicsShape.h"
@@ -37,35 +37,35 @@ void GpuCompoundScene::setupScene(const ConstructionInfo& ci)
btAssert(stride2 == strideInBytes);
int index=0;
int colIndex = -1;
btAlignedObjectArray<GLInstanceVertex> vertexArray;
btAlignedObjectArray<int> indexArray;
b3AlignedObjectArray<GLInstanceVertex> vertexArray;
b3AlignedObjectArray<int> indexArray;
{
int childColIndex = m_data->m_np->registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
btVector3 childPositions[3] = {
btVector3(0,-2,0),
btVector3(0,0,0),
btVector3(0,0,2)
b3Vector3 childPositions[3] = {
b3Vector3(0,-2,0),
b3Vector3(0,0,0),
b3Vector3(0,0,2)
};
btAlignedObjectArray<btGpuChildShape> childShapes;
b3AlignedObjectArray<btGpuChildShape> childShapes;
int numChildShapes = 3;
for (int i=0;i<numChildShapes;i++)
{
//for now, only support polyhedral child shapes
btGpuChildShape child;
child.m_shapeIndex = childColIndex;
btVector3 pos = childPositions[i];
btQuaternion orn(0,0,0,1);
b3Vector3 pos = childPositions[i];
b3Quaternion orn(0,0,0,1);
for (int v=0;v<4;v++)
{
child.m_childPosition[v] = pos[v];
child.m_childOrientation[v] = orn[v];
}
childShapes.push_back(child);
btTransform tr;
b3Transform tr;
tr.setIdentity();
tr.setOrigin(pos);
tr.setRotation(orn);
@@ -78,8 +78,8 @@ void GpuCompoundScene::setupScene(const ConstructionInfo& ci)
for (int v=0;v<numVertices;v++)
{
GLInstanceVertex vert = cubeVerts[v];
btVector3 vertPos(vert.xyzw[0],vert.xyzw[1],vert.xyzw[2]);
btVector3 newPos = tr*vertPos;
b3Vector3 vertPos(vert.xyzw[0],vert.xyzw[1],vert.xyzw[2]);
b3Vector3 newPos = tr*vertPos;
vert.xyzw[0] = newPos[0];
vert.xyzw[1] = newPos[1];
vert.xyzw[2] = newPos[2];
@@ -113,9 +113,9 @@ void GpuCompoundScene::setupScene(const ConstructionInfo& ci)
{
float mass = 1;//j==0? 0.f : 1.f;
btVector3 position(i*ci.gapX,10+j*ci.gapY,k*ci.gapZ);
//btQuaternion orn(0,0,0,1);
btQuaternion orn(btVector3(1,0,0),0.7);
b3Vector3 position(i*ci.gapX,10+j*ci.gapY,k*ci.gapZ);
//b3Quaternion orn(0,0,0,1);
b3Quaternion orn(b3Vector3(1,0,0),0.7);
btVector4 color = colors[curColor];
curColor++;
@@ -208,11 +208,11 @@ void GpuCompoundScene::createStaticEnvironment(const ConstructionInfo& ci)
int colIndex = m_data->m_np->registerSphereShape(radius);//>registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
float mass = 0.f;
//btVector3 position((j&1)+i*2.2,1+j*2.,(j&1)+k*2.2);
btVector3 position(0,-41,0);
//b3Vector3 position((j&1)+i*2.2,1+j*2.,(j&1)+k*2.2);
b3Vector3 position(0,-41,0);
btQuaternion orn(0,0,0,1);
b3Quaternion orn(0,0,0,1);
btVector4 color = colors[curColor];
curColor++;
@@ -232,12 +232,12 @@ void GpuCompoundPlaneScene::createStaticEnvironment(const ConstructionInfo& ci)
{
int index=0;
btVector3 normal(0,1,0);
b3Vector3 normal(0,1,0);
float constant=0.f;
int colIndex = m_data->m_np->registerPlaneShape(normal,constant);//>registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
btVector3 position(0,0,0);
btQuaternion orn(0,0,0,1);
// btQuaternion orn(btVector3(1,0,0),0.3);
b3Vector3 position(0,0,0);
b3Quaternion orn(0,0,0,1);
// b3Quaternion orn(b3Vector3(1,0,0),0.3);
btVector4 color(0,0,1,1);
btVector4 scaling(100,0.01,100,1);
int strideInBytes = 9*sizeof(float);

View File

@@ -1,10 +1,10 @@
#include "GpuConvexScene.h"
#include "GpuRigidBodyDemo.h"
#include "BulletCommon/btQuickprof.h"
#include "BulletCommon/b3Quickprof.h"
#include "OpenGLWindow/ShapeData.h"
#include "OpenGLWindow/GLInstancingRenderer.h"
#include "BulletCommon/btQuaternion.h"
#include "BulletCommon/b3Quaternion.h"
#include "OpenGLWindow/btgWindowInterface.h"
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
#include "../GpuDemoInternalData.h"
@@ -91,10 +91,10 @@ int GpuConvexScene::createDynamicsObjects2(const ConstructionInfo& ci, const flo
{
float mass = 1.f;
btVector3 position((j&1)+i*2.2,1+j*2.,(j&1)+k*2.2);
//btVector3 position(i*2.2,1+j*2.,k*2.2);
b3Vector3 position((j&1)+i*2.2,1+j*2.,(j&1)+k*2.2);
//b3Vector3 position(i*2.2,1+j*2.,k*2.2);
btQuaternion orn(0,0,0,1);
b3Quaternion orn(0,0,0,1);
btVector4 color = colors[curColor];
curColor++;
@@ -126,8 +126,8 @@ void GpuConvexScene::createStaticEnvironment(const ConstructionInfo& ci)
{
btVector4 scaling(400,1,400,1);
int colIndex = m_data->m_np->registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
btVector3 position(0,0,0);
btQuaternion orn(0,0,0,1);
b3Vector3 position(0,0,0);
b3Quaternion orn(0,0,0,1);
btVector4 color(0,0,1,1);
@@ -140,12 +140,12 @@ void GpuConvexScene::createStaticEnvironment(const ConstructionInfo& ci)
void GpuConvexPlaneScene::createStaticEnvironment(const ConstructionInfo& ci)
{
int index=0;
btVector3 normal(0,1,0);
b3Vector3 normal(0,1,0);
float constant=0.f;
int colIndex = m_data->m_np->registerPlaneShape(normal,constant);//>registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
btVector3 position(0,0,0);
btQuaternion orn(0,0,0,1);
// btQuaternion orn(btVector3(1,0,0),0.3);
b3Vector3 position(0,0,0);
b3Quaternion orn(0,0,0,1);
// b3Quaternion orn(b3Vector3(1,0,0),0.3);
btVector4 color(0,0,1,1);
btVector4 scaling(100,0.001,100,1);
int strideInBytes = 9*sizeof(float);

View File

@@ -1,8 +1,8 @@
#include "GpuRigidBodyDemo.h"
#include "BulletCommon/btQuickprof.h"
#include "BulletCommon/b3Quickprof.h"
#include "OpenGLWindow/ShapeData.h"
#include "OpenGLWindow/GLInstancingRenderer.h"
#include "BulletCommon/btQuaternion.h"
#include "BulletCommon/b3Quaternion.h"
#include "OpenGLWindow/btgWindowInterface.h"
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
#include "../GpuDemoInternalData.h"

View File

@@ -3,7 +3,7 @@
#include "basic_initialize/b3OpenCLUtils.h"
#include "parallel_primitives/host/btOpenCLArray.h"
#include "BulletCommon/btVector3.h"
#include "BulletCommon/b3Vector3.h"
struct GpuRigidBodyDemoInternalData
{

View File

@@ -1,10 +1,10 @@
#include "GpuSphereScene.h"
#include "GpuRigidBodyDemo.h"
#include "BulletCommon/btQuickprof.h"
#include "BulletCommon/b3Quickprof.h"
#include "OpenGLWindow/ShapeData.h"
#include "OpenGLWindow/GLInstancingRenderer.h"
#include "BulletCommon/btQuaternion.h"
#include "BulletCommon/b3Quaternion.h"
#include "OpenGLWindow/btgWindowInterface.h"
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
#include "../GpuDemoInternalData.h"
@@ -85,10 +85,10 @@ void GpuSphereScene::setupScene(const ConstructionInfo& ci)
int colIndex = m_data->m_np->registerSphereShape(radius);//>registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
float mass = 0.f;
//btVector3 position((j&1)+i*2.2,1+j*2.,(j&1)+k*2.2);
btVector3 position(0,0,0);
//b3Vector3 position((j&1)+i*2.2,1+j*2.,(j&1)+k*2.2);
b3Vector3 position(0,0,0);
btQuaternion orn(0,0,0,1);
b3Quaternion orn(0,0,0,1);
btVector4 color = colors[curColor];
curColor++;
@@ -141,11 +141,11 @@ void GpuSphereScene::setupScene(const ConstructionInfo& ci)
int i=0,j=0,k=0;
float mass = 0.f;
btVector3 position(0,0,0);
//btVector3 position((j&1)+i*142.2,-51+j*142.,(j&1)+k*142.2);
//btVector3 position(0,-41,0);//0,0,0);//i*radius*3,-41+j*radius*3,k*radius*3);
b3Vector3 position(0,0,0);
//b3Vector3 position((j&1)+i*142.2,-51+j*142.,(j&1)+k*142.2);
//b3Vector3 position(0,-41,0);//0,0,0);//i*radius*3,-41+j*radius*3,k*radius*3);
btQuaternion orn(0,0,0,1);
b3Quaternion orn(0,0,0,1);
btVector4 color = colors[curColor];
curColor++;
@@ -165,7 +165,7 @@ void GpuSphereScene::setupScene(const ConstructionInfo& ci)
int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
btVector4 scaling(0.5,0.5,0.5,1);//1,1,1,1);//0.1,0.1,0.1,1);
int colIndex = m_data->m_np->registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
btVector3 normal(0,-1,0);
b3Vector3 normal(0,-1,0);
float constant=2;
@@ -176,8 +176,8 @@ void GpuSphereScene::setupScene(const ConstructionInfo& ci)
{
//int colIndex = m_data->m_np->registerPlaneShape(normal,constant);//>registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
btVector4 position(2*i,70+k*2,2*j+8,0);
//btQuaternion orn(0,0,0,1);
btQuaternion orn(btVector3(1,0,0),0.3);
//b3Quaternion orn(0,0,0,1);
b3Quaternion orn(b3Vector3(1,0,0),0.3);
btVector4 color(0,0,1,1);