diff --git a/Demos/DX11ClothDemo/cloth_renderer.cpp b/Demos/DX11ClothDemo/cloth_renderer.cpp index b1635cb5f..8c6031152 100644 --- a/Demos/DX11ClothDemo/cloth_renderer.cpp +++ b/Demos/DX11ClothDemo/cloth_renderer.cpp @@ -38,7 +38,7 @@ class btDX11SIMDAwareSoftBodySolver; #include "BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.h" #define USE_SIMDAWARE_SOLVER -#define USE_GPU_SOLVER +//#define USE_GPU_SOLVER #define USE_GPU_COPY const int numFlags = 5; const int clothWidth = 40; diff --git a/Demos/OpenGL/Win32AppMain.cpp b/Demos/OpenGL/Win32AppMain.cpp index 9ef788e72..84f48a316 100644 --- a/Demos/OpenGL/Win32AppMain.cpp +++ b/Demos/OpenGL/Win32AppMain.cpp @@ -306,6 +306,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) return 0; } default: + { + gDemoApplication->keyboardUpCallback(tolower(wParam),0,0); + } return DefWindowProc( hWnd, message, wParam, lParam ); } diff --git a/Demos/SerializeDemo/SerializeDemo.cpp b/Demos/SerializeDemo/SerializeDemo.cpp index 728f218d8..cf628c9ee 100644 --- a/Demos/SerializeDemo/SerializeDemo.cpp +++ b/Demos/SerializeDemo/SerializeDemo.cpp @@ -502,6 +502,13 @@ public: #endif //DESERIALIZE_SOFT_BODIES +SerializeDemo::~SerializeDemo() +{ + m_fileLoader->deleteAllData(); + delete m_fileLoader; + exitPhysics(); +} + void SerializeDemo::initPhysics() { setTexturing(true); @@ -512,14 +519,14 @@ void SerializeDemo::initPhysics() setupEmptyDynamicsWorld(); #ifdef DESERIALIZE_SOFT_BODIES - btBulletWorldImporter* fileLoader = new MySoftBulletWorldImporter((btSoftRigidDynamicsWorld*)m_dynamicsWorld); + m_fileLoader = new MySoftBulletWorldImporter((btSoftRigidDynamicsWorld*)m_dynamicsWorld); #else - btBulletWorldImporter* fileLoader = new btBulletWorldImporter(m_dynamicsWorld); + m_fileLoader = new btBulletWorldImporter(m_dynamicsWorld); #endif //DESERIALIZE_SOFT_BODIES // fileLoader->setVerboseMode(true); - if (!fileLoader->loadFile("testFile.bullet")) -// if (!fileLoader->loadFile("../SoftDemo/testFile.bullet")) + if (!m_fileLoader->loadFile("testFile.bullet")) +// if (!m_fileLoader->loadFile("../SoftDemo/testFile.bullet")) { ///create a few basic rigid bodies and save them to testFile.bullet btCollisionShape* groundShape = new btBoxShape(btVector3(btScalar(50.),btScalar(50.),btScalar(50.))); diff --git a/Demos/SerializeDemo/SerializeDemo.h b/Demos/SerializeDemo/SerializeDemo.h index 0978fede2..a5b1344b0 100644 --- a/Demos/SerializeDemo/SerializeDemo.h +++ b/Demos/SerializeDemo/SerializeDemo.h @@ -49,15 +49,15 @@ class SerializeDemo : public PlatformDemoApplication btDefaultCollisionConfiguration* m_collisionConfiguration; + class btBulletWorldImporter* m_fileLoader; + public: SerializeDemo() { } - virtual ~SerializeDemo() - { - exitPhysics(); - } + virtual ~SerializeDemo(); + void initPhysics(); void setupEmptyDynamicsWorld(); diff --git a/Extras/Serialize/BulletWorldImporter/btBulletWorldImporter.cpp b/Extras/Serialize/BulletWorldImporter/btBulletWorldImporter.cpp index d059ccc1a..25b8394e3 100644 --- a/Extras/Serialize/BulletWorldImporter/btBulletWorldImporter.cpp +++ b/Extras/Serialize/BulletWorldImporter/btBulletWorldImporter.cpp @@ -25,24 +25,32 @@ btBulletWorldImporter::~btBulletWorldImporter() void btBulletWorldImporter::deleteAllData() { int i; + for (i=0;iremoveConstraint(m_allocatedConstraints[i]); + delete m_allocatedConstraints[i]; + } + m_allocatedConstraints.clear(); + + + for (i=0;iremoveRigidBody(btRigidBody::upcast(m_allocatedRigidBodies[i])); + delete m_allocatedRigidBodies[i]; + } + + m_allocatedRigidBodies.clear(); + + for (i=0;i