From 1c29d02305685a942742846c757775800202a52a Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Sun, 21 Sep 2008 15:17:50 +0000 Subject: BGE real-time soft bodies, step 2 / 3: create a btSoftBody. Next step is hooking up / deform graphics mesh and choose collision shape. Note: feature is still disabled. --- .../src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp | 5 +++-- .../src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h | 1 - .../src/BulletCollision/CollisionDispatch/btCollisionObject.h | 2 +- extern/bullet2/src/BulletSoftBody/btSoftBody.cpp | 2 +- extern/bullet2/src/BulletSoftBody/btSoftBody.h | 7 +++++++ extern/bullet2/src/BulletSoftBody/btSoftBodyInternals.h | 1 - 6 files changed, 12 insertions(+), 6 deletions(-) (limited to 'extern') diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp index e711078f4e2..e00fc6aa5e3 100644 --- a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp +++ b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp @@ -119,7 +119,7 @@ void Process(const btDbvtNode* n) // btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache* paircache) { -m_deferedcollide = true;//false; +m_deferedcollide = false; m_needcleanup = true; m_releasepaircache = (paircache!=0)?false:true; m_prediction = 1/(btScalar)2; @@ -164,7 +164,7 @@ btBroadphaseProxy* btDbvtBroadphase::createProxy( const btVector3& aabbMin, void* userPtr, short int collisionFilterGroup, short int collisionFilterMask, - btDispatcher* dispatcher, + btDispatcher* /*dispatcher*/, void* /*multiSapProxy*/) { btDbvtProxy* proxy=new(btAlignedAlloc(sizeof(btDbvtProxy),16)) btDbvtProxy( userPtr, @@ -180,6 +180,7 @@ if(!m_deferedcollide) btDbvtTreeCollider collider(this); collider.proxy=proxy; btDbvt::collideTV(m_sets[0].m_root,proxy->aabb,collider); + btDbvt::collideTV(m_sets[1].m_root,proxy->aabb,collider); } return(proxy); } diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h index 4576e48f3f4..1f16043a7a8 100644 --- a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h +++ b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h @@ -86,7 +86,6 @@ int m_gid; // Gen id bool m_releasepaircache; // Release pair cache on delete bool m_deferedcollide; // Defere dynamic/static collision to collide call bool m_needcleanup; // Need to run cleanup? -bool m_initialize; // Initialization #if DBVT_BP_PROFILE btClock m_clock; struct { diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h index 7ef3787b3ac..0961f3e75c9 100644 --- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h +++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h @@ -143,7 +143,7 @@ public: virtual ~btCollisionObject(); - void setCollisionShape(btCollisionShape* collisionShape) + virtual void setCollisionShape(btCollisionShape* collisionShape) { m_collisionShape = collisionShape; m_rootCollisionShape = collisionShape; diff --git a/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp b/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp index 91b9d6f1bbd..e42a613343b 100644 --- a/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp +++ b/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp @@ -69,7 +69,7 @@ btSoftBody::btSoftBody(btSoftBodyWorldInfo* worldInfo,int node_count, const btV pm->m_flags = fMaterial::Default; /* Collision shape */ ///for now, create a collision shape internally - setCollisionShape(new btSoftBodyCollisionShape(this)); + m_collisionShape = new btSoftBodyCollisionShape(this); m_collisionShape->setMargin(0.25); /* Nodes */ const btScalar margin=getCollisionShape()->getMargin(); diff --git a/extern/bullet2/src/BulletSoftBody/btSoftBody.h b/extern/bullet2/src/BulletSoftBody/btSoftBody.h index 91d732b4e9a..4306ed9c471 100644 --- a/extern/bullet2/src/BulletSoftBody/btSoftBody.h +++ b/extern/bullet2/src/BulletSoftBody/btSoftBody.h @@ -606,6 +606,13 @@ public: /* dtor */ virtual ~btSoftBody(); /* Check for existing link */ + + + virtual void setCollisionShape(btCollisionShape* collisionShape) + { + //don't do anything, due to the internal shape hack: todo: fix this + } + bool checkLink( int node0, int node1) const; bool checkLink( const Node* node0, diff --git a/extern/bullet2/src/BulletSoftBody/btSoftBodyInternals.h b/extern/bullet2/src/BulletSoftBody/btSoftBodyInternals.h index 1a7be2cb840..8fcf633fecc 100644 --- a/extern/bullet2/src/BulletSoftBody/btSoftBodyInternals.h +++ b/extern/bullet2/src/BulletSoftBody/btSoftBodyInternals.h @@ -94,7 +94,6 @@ public: virtual void setLocalScaling(const btVector3& /*scaling*/) { ///na - btAssert(0); } virtual const btVector3& getLocalScaling() const { -- cgit v1.2.3