diff --git a/CMakeLists.txt b/CMakeLists.txt index 74cd3c291..f564c5be0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.4) PROJECT(BULLET_PHYSICS) IF (NOT CMAKE_BUILD_TYPE) - SET(CMAKE_BUILD_TYPE "Release") + SET(CMAKE_BUILD_TYPE "Debug") ENDIF (NOT CMAKE_BUILD_TYPE) @@ -25,6 +25,7 @@ MESSAGE("OPENGL NOT FOUND") SET(OPENGL_gl_LIBRARY opengl32) SET(OPENGL_glu_LIBRARY glu32) ENDIF (OPENGL_FOUND) +ADD_DEFINITIONS(-DBT_USE_FREEGLUT) FIND_PACKAGE(GLU) diff --git a/Demos/ConvexDecompositionDemo/CMakeLists.txt b/Demos/ConvexDecompositionDemo/CMakeLists.txt new file mode 100644 index 000000000..b4c484f77 --- /dev/null +++ b/Demos/ConvexDecompositionDemo/CMakeLists.txt @@ -0,0 +1,26 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + +# This is the variable for Windows. I use this to define the root of my directory structure. +SET(GLUT_ROOT ${BULLET_PHYSICS_SOURCE_DIR}/Glut) + +# You shouldn't have to modify anything below this line +######################################################## + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL ${BULLET_PHYSICS_SOURCE_DIR}/Extras/ConvexDecomposition +) + +LINK_LIBRARIES( +LibOpenGLSupport LibBulletDynamics LibBulletCollision LibLinearMath LibConvexDecomposition ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(ConvexDecompositionDemo + main.cpp + ConvexDecompositionDemo.cpp +) + diff --git a/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp b/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp index 2a693c304..4d6f4710b 100644 --- a/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp +++ b/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp @@ -351,6 +351,8 @@ void ConvexDecompositionDemo::initPhysics(const char* filename) startTransform.setOrigin(convexDecompositionObjectOffset); localCreateRigidBody(0.f,startTransform,concaveShape); + m_collisionShapes.push_back (concaveShape); + } diff --git a/Demos/ConvexDecompositionDemo/main.cpp b/Demos/ConvexDecompositionDemo/main.cpp index fd6ae8a61..0d9d30288 100644 --- a/Demos/ConvexDecompositionDemo/main.cpp +++ b/Demos/ConvexDecompositionDemo/main.cpp @@ -23,6 +23,10 @@ int main(int argc,char** argv) - return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://www.continuousphysics.com/Bullet/phpBB2/",convexDecompDemo); + glutmain(argc, argv,640,480,"Bullet Physics Demo. http://www.continuousphysics.com/Bullet/phpBB2/",convexDecompDemo); + + delete convexDecompDemo; + + return 0; } diff --git a/Extras/BulletColladaConverter/ColladaConverter.cpp b/Extras/BulletColladaConverter/ColladaConverter.cpp index b79e30f98..cd17c78df 100644 --- a/Extras/BulletColladaConverter/ColladaConverter.cpp +++ b/Extras/BulletColladaConverter/ColladaConverter.cpp @@ -176,6 +176,19 @@ ColladaConverter::~ColladaConverter () m_collada = NULL; m_dom = NULL; + + for(int i=0;i not supported, transformed into convex\n"); - rbOutput.m_colShape = new btConvexTriangleMeshShape(trimesh); - } else - { - printf("static concave triangle added\n"); - bool useQuantizedAabbCompression = true; - rbOutput.m_colShape = new btBvhTriangleMeshShape(trimesh,useQuantizedAabbCompression); - //rbOutput.m_colShape = new btBvhTriangleMeshShape(trimesh); - //rbOutput.m_colShape = new btConvexTriangleMeshShape(trimesh); - - //btTriangleMeshShape - } - //rbOutput.m_colShape->setTypedUserInfo (new btShapeColladaInfo (geom)); - } + + if (rbOutput.m_isDynamics) + { + printf("moving concave not supported, transformed into convex\n"); + rbOutput.m_colShape = new btConvexTriangleMeshShape(trimesh); + } else + { + printf("static concave triangle added\n"); + bool useQuantizedAabbCompression = true; + rbOutput.m_colShape = new btBvhTriangleMeshShape(trimesh,useQuantizedAabbCompression); + //rbOutput.m_colShape = new btBvhTriangleMeshShape(trimesh); + //rbOutput.m_colShape = new btConvexTriangleMeshShape(trimesh); + + //btTriangleMeshShape + } + //rbOutput.m_colShape->setTypedUserInfo (new btShapeColladaInfo (geom)); + } else { diff --git a/Extras/ConvexDecomposition/ConvexBuilder.cpp b/Extras/ConvexDecomposition/ConvexBuilder.cpp index 83a1157be..baf80f42a 100644 --- a/Extras/ConvexDecomposition/ConvexBuilder.cpp +++ b/Extras/ConvexDecomposition/ConvexBuilder.cpp @@ -150,7 +150,10 @@ CHull * ConvexBuilder::canMerge(CHull *a,CHull *b) //don't do anything if hull is empty if (!tcount) + { + Vl_releaseVertexLookup (vc); return 0; + } HullResult hresult; HullLibrary hl; @@ -323,6 +326,8 @@ unsigned int ConvexBuilder::process(const DecompDesc &desc) mCallback->ConvexDecompResult(r); } + hl.ReleaseResult (result); + delete cr; } diff --git a/Extras/ConvexDecomposition/ConvexDecomposition.cpp b/Extras/ConvexDecomposition/ConvexDecomposition.cpp index c1d431f24..a797eed9a 100644 --- a/Extras/ConvexDecomposition/ConvexDecomposition.cpp +++ b/Extras/ConvexDecomposition/ConvexDecomposition.cpp @@ -204,6 +204,7 @@ void calcConvexDecomposition(unsigned int vcount, } #endif + hl.ReleaseResult (result); return; } diff --git a/Extras/ConvexDecomposition/cd_wavefront.cpp b/Extras/ConvexDecomposition/cd_wavefront.cpp index add00f986..b67077559 100644 --- a/Extras/ConvexDecomposition/cd_wavefront.cpp +++ b/Extras/ConvexDecomposition/cd_wavefront.cpp @@ -816,8 +816,8 @@ WavefrontObj::WavefrontObj(void) WavefrontObj::~WavefrontObj(void) { - delete mIndices; - delete mVertices; + delete [] mIndices; + delete [] mVertices; } unsigned int WavefrontObj::loadObj(const char *fname) // load a wavefront obj returns number of triangles that were loaded. Data is persists until the class is destructed. @@ -825,9 +825,9 @@ unsigned int WavefrontObj::loadObj(const char *fname) // load a wavefront obj re unsigned int ret = 0; - delete mVertices; + delete [] mVertices; mVertices = 0; - delete mIndices; + delete [] mIndices; mIndices = 0; mVertexCount = 0; mTriCount = 0; diff --git a/src/BulletSoftBody/btSoftBody.cpp b/src/BulletSoftBody/btSoftBody.cpp index 36a9a73d7..6320258aa 100644 --- a/src/BulletSoftBody/btSoftBody.cpp +++ b/src/BulletSoftBody/btSoftBody.cpp @@ -97,6 +97,8 @@ btSoftBody::~btSoftBody() delete m_collisionShape; int i; + for(i=0;i