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

@@ -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);