diff --git a/Demos3/GpuDemos/main_opengl3core.cpp b/Demos3/GpuDemos/main_opengl3core.cpp index cea55d94c..afe3508d9 100644 --- a/Demos3/GpuDemos/main_opengl3core.cpp +++ b/Demos3/GpuDemos/main_opengl3core.cpp @@ -106,16 +106,12 @@ GpuDemo::CreateFunc* allDemos[]= - ConcaveScene::MyCreateFunc, - + ConcaveSphereScene::MyCreateFunc, ConcaveCompoundScene::MyCreateFunc, -// GpuCompoundPlaneScene::MyCreateFunc, - - - GpuConstraintsDemo::MyCreateFunc, + GpuCompoundPlaneScene::MyCreateFunc, GpuTetraScene::MyCreateFunc, diff --git a/Demos3/GpuDemos/rigidbody/ConcaveScene.cpp b/Demos3/GpuDemos/rigidbody/ConcaveScene.cpp index 3617ba5eb..413542095 100644 --- a/Demos3/GpuDemos/rigidbody/ConcaveScene.cpp +++ b/Demos3/GpuDemos/rigidbody/ConcaveScene.cpp @@ -680,7 +680,7 @@ b3Vector3 childPositions[3] = { { float mass = 1;//j==0? 0.f : 1.f; - b3Vector3 position(i*ci.gapX,50+j*ci.gapY,k*ci.gapZ); + b3Vector3 position((-ci.arraySizeX/2+i)*ci.gapX,50+j*ci.gapY,(-ci.arraySizeZ/2+k)*ci.gapZ); //b3Quaternion orn(0,0,0,1); b3Quaternion orn(b3Vector3(1,0,0),0.7); diff --git a/Demos3/GpuDemos/rigidbody/ConcaveScene.h b/Demos3/GpuDemos/rigidbody/ConcaveScene.h index 47fe8597b..79e87e422 100644 --- a/Demos3/GpuDemos/rigidbody/ConcaveScene.h +++ b/Demos3/GpuDemos/rigidbody/ConcaveScene.h @@ -12,7 +12,7 @@ public: virtual ~ConcaveScene(){} virtual const char* getName() { - return "GRBConcave"; + return "BoxTrimesh"; } static GpuDemo* MyCreateFunc() @@ -38,7 +38,7 @@ public: virtual ~ConcaveSphereScene(){} virtual const char* getName() { - return "ConcaveSphere"; + return "SphereTrimesh"; } static GpuDemo* MyCreateFunc() @@ -62,7 +62,7 @@ public: virtual ~ConcaveCompoundScene(){} virtual const char* getName() { - return "GRBConcaveCompound"; + return "CompoundConcave"; } static GpuDemo* MyCreateFunc() diff --git a/Demos3/GpuDemos/rigidbody/GpuCompoundScene.h b/Demos3/GpuDemos/rigidbody/GpuCompoundScene.h index c08e5bbe7..de3f9e171 100644 --- a/Demos3/GpuDemos/rigidbody/GpuCompoundScene.h +++ b/Demos3/GpuDemos/rigidbody/GpuCompoundScene.h @@ -11,7 +11,7 @@ public: virtual ~GpuCompoundScene(){} virtual const char* getName() { - return "GpuCompound"; + return "CompoundOnSphere"; } static GpuDemo* MyCreateFunc() @@ -35,7 +35,7 @@ public: virtual ~GpuCompoundPlaneScene(){} virtual const char* getName() { - return "GpuCompoundPlane"; + return "CompoundOnPlane"; } static GpuDemo* MyCreateFunc() diff --git a/Demos3/GpuDemos/rigidbody/GpuConvexScene.h b/Demos3/GpuDemos/rigidbody/GpuConvexScene.h index 42cb21ccc..7e6d970de 100644 --- a/Demos3/GpuDemos/rigidbody/GpuConvexScene.h +++ b/Demos3/GpuDemos/rigidbody/GpuConvexScene.h @@ -20,7 +20,7 @@ public: virtual ~GpuConvexScene(){} virtual const char* getName() { - return "GRBConvex"; + return "Tetrahedra"; } static GpuDemo* MyCreateFunc() @@ -50,7 +50,7 @@ public: virtual ~GpuConvexPlaneScene(){} virtual const char* getName() { - return "GRBConvexPlane"; + return "ConvexOnPlane"; } static GpuDemo* MyCreateFunc() @@ -72,7 +72,7 @@ public: virtual ~GpuBoxPlaneScene(){} virtual const char* getName() { - return "GRBBoxPlane"; + return "BoxPlane"; } static GpuDemo* MyCreateFunc() @@ -97,7 +97,7 @@ void createFromTetGenData(const char* ele, public: virtual const char* getName() { - return "GpuTetraScene"; + return "TetraBreakable"; } static GpuDemo* MyCreateFunc() diff --git a/Demos3/GpuDemos/rigidbody/GpuSphereScene.h b/Demos3/GpuDemos/rigidbody/GpuSphereScene.h index f4f5b3545..b3fcfbae1 100644 --- a/Demos3/GpuDemos/rigidbody/GpuSphereScene.h +++ b/Demos3/GpuDemos/rigidbody/GpuSphereScene.h @@ -11,7 +11,7 @@ public: virtual ~GpuSphereScene(){} virtual const char* getName() { - return "GRBSphere"; + return "BoxOnSphere"; } static GpuDemo* MyCreateFunc() diff --git a/btgui/OpenGLWindow/ShapeData.h b/btgui/OpenGLWindow/ShapeData.h index fc566d31d..a51a9c19b 100644 --- a/btgui/OpenGLWindow/ShapeData.h +++ b/btgui/OpenGLWindow/ShapeData.h @@ -263,7 +263,7 @@ static const int quad_indices[]= -static const float tetra_vertices[] = +static const float pyramid_vertices[] = { -1.f, 0, -1.f, 0.5f, 0, 1,0, 0,0, -1.f, 0, 1.f, 0.5f, 0, 1,0, 1,0, @@ -275,13 +275,35 @@ static const float tetra_vertices[] = -static const int tetra_indices[]= +static const int pyramid_indices[]= { 0,1,2,0,2,3,//ground face 4,1,2,4,2,3, 4,3,0,4,0,1 }; +static const float tetra_vertices[] = +{ + 1.f, 1.f, 1.f, 0.5f, 0, 1,0, 0,0, + 1.f, -1.f, -1.f, 0.5f, 0, 1,0, 1,0, + -1.f, 1.f, -1.f, 0.5f, 0, 1,0, 1,1, + -1.f, -1, 1.f, 0.5f, 0, 1,0, 0,1 +}; + + + + +static const int tetra_indices[]= +{ + 0,1,2,//ground face + 3,1,2, + 3,0,1, + 3,2,0 +}; + + + + static const float detailed_sphere_vertices[] = { 0.000000,-0.183479,-0.983024,0.000000,0.000000,-0.183479,-0.983024,0.500000,0.408260, diff --git a/build3/premake4.lua b/build3/premake4.lua index 54ae74836..443ac0dda 100644 --- a/build3/premake4.lua +++ b/build3/premake4.lua @@ -99,10 +99,13 @@ language "C++" +if not _OPTIONS["ios"] then + + include "../Demos3/GpuDemos" include "../Demos3/Wavefront" include "../btgui/MultiThreading" - if not _OPTIONS["ios"] then + -- include "../demo/gpudemo" -- include "../btgui/MidiTest" -- include "../opencl/vector_add_simplified" @@ -126,7 +129,7 @@ include "../src/Bullet3Serialize/Bullet2FileLoader" include "../src/Bullet3OpenCL" - include "../Demos3/GpuDemos" + -- include "../demo/gpu_initialize" diff --git a/data/testFile.bullet b/data/testFile.bullet index 1413f2d7c..a444865a1 100644 Binary files a/data/testFile.bullet and b/data/testFile.bullet differ diff --git a/data/testFileFracture.bullet b/data/testFileFracture.bullet new file mode 100644 index 000000000..1413f2d7c Binary files /dev/null and b/data/testFileFracture.bullet differ diff --git a/src/Bullet3OpenCL/NarrowphaseCollision/b3ConvexHullContact.cpp b/src/Bullet3OpenCL/NarrowphaseCollision/b3ConvexHullContact.cpp index a9a128462..a8ea6b7ca 100644 --- a/src/Bullet3OpenCL/NarrowphaseCollision/b3ConvexHullContact.cpp +++ b/src/Bullet3OpenCL/NarrowphaseCollision/b3ConvexHullContact.cpp @@ -1685,6 +1685,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( const b3OpenCLArray* bodyBuf, b3OpenCLArray* contactOut, int& nContacts, int maxContactCapacity, + int compoundPairCapacity, const b3OpenCLArray& convexData, const b3OpenCLArray& gpuVertices, const b3OpenCLArray& gpuUniqueEdges, @@ -1884,7 +1885,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( const b3OpenCLArray maxTriConvexPairCapacity) { static int exceeded_maxTriConvexPairCapacity_count = 0; - printf("Rxceeded %d times the maxTriConvexPairCapacity (found %d but max is %d)\n", exceeded_maxTriConvexPairCapacity_count++, + b3Error("Rxceeded %d times the maxTriConvexPairCapacity (found %d but max is %d)\n", exceeded_maxTriConvexPairCapacity_count++, numConcavePairs,maxTriConvexPairCapacity); numConcavePairs = maxTriConvexPairCapacity; } @@ -2043,7 +2044,10 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( const b3OpenCLArray compoundPairCapacity) + { + b3Error("Exceeded compound pair capacity (%d/%d)\n", numCompoundPairs, compoundPairCapacity); numCompoundPairs = compoundPairCapacity; + } m_gpuCompoundPairs.resize(numCompoundPairs); m_gpuHasCompoundSepNormals.resize(numCompoundPairs); @@ -2079,6 +2083,12 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( const b3OpenCLArraymaxContactCapacity) + { + + b3Error("Error: contacts exceeds capacity (%d/%d)\n", nContacts, maxContactCapacity); + nContacts = maxContactCapacity; + } #endif } @@ -2159,6 +2169,11 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( const b3OpenCLArray= maxContactCapacity) + { + b3Error("Error: contacts exceeds capacity (%d/%d)\n", nContacts, maxContactCapacity); + nContacts = maxContactCapacity; + } } } @@ -2424,6 +2439,12 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( const b3OpenCLArraymaxContactCapacity) + { + + b3Error("Error: contacts exceeds capacity (%d/%d)\n", nContacts, maxContactCapacity); + nContacts = maxContactCapacity; + } contactOut->resize(nContacts); } } diff --git a/src/Bullet3OpenCL/NarrowphaseCollision/b3ConvexHullContact.h b/src/Bullet3OpenCL/NarrowphaseCollision/b3ConvexHullContact.h index 700e719fd..b138931ff 100644 --- a/src/Bullet3OpenCL/NarrowphaseCollision/b3ConvexHullContact.h +++ b/src/Bullet3OpenCL/NarrowphaseCollision/b3ConvexHullContact.h @@ -79,6 +79,7 @@ struct GpuSatCollision const b3OpenCLArray* bodyBuf, b3OpenCLArray* contactOut, int& nContacts, int maxContactCapacity, + int compoundPairCapacity, const b3OpenCLArray& hostConvexData, const b3OpenCLArray& vertices, const b3OpenCLArray& uniqueEdges, diff --git a/src/Bullet3OpenCL/RigidBody/b3Config.h b/src/Bullet3OpenCL/RigidBody/b3Config.h index be7686ccf..ff83327b0 100644 --- a/src/Bullet3OpenCL/RigidBody/b3Config.h +++ b/src/Bullet3OpenCL/RigidBody/b3Config.h @@ -7,6 +7,7 @@ struct b3Config int m_maxConvexShapes; int m_maxBroadphasePairs; int m_maxContactCapacity; + int m_compoundPairCapacity; int m_maxVerticesPerFace; int m_maxFacesPerShape; @@ -31,6 +32,7 @@ struct b3Config m_maxConvexShapes = m_maxConvexBodies; m_maxBroadphasePairs = 16*m_maxConvexBodies; m_maxContactCapacity = m_maxBroadphasePairs; + m_compoundPairCapacity = 1524*1024; } }; diff --git a/src/Bullet3OpenCL/RigidBody/b3GpuNarrowPhase.cpp b/src/Bullet3OpenCL/RigidBody/b3GpuNarrowPhase.cpp index 038924c12..b60828548 100644 --- a/src/Bullet3OpenCL/RigidBody/b3GpuNarrowPhase.cpp +++ b/src/Bullet3OpenCL/RigidBody/b3GpuNarrowPhase.cpp @@ -738,6 +738,7 @@ void b3GpuNarrowPhase::computeContacts(cl_mem broadphasePairs, int numBroadphase m_data->m_pBufContactOutGPU, nContactOut, m_data->m_config.m_maxContactCapacity, + m_data->m_config.m_compoundPairCapacity, *m_data->m_convexPolyhedraGPU, *m_data->m_convexVerticesGPU, *m_data->m_uniqueEdgesGPU,