fix memory issues in btSparseSDF.h

(hash function on structure with uninitialized padding, and  Reset not called in destructor)
expose sparseSdfVoxelSize in PyBullet.setPhysicsEngineParameter
don't call deformable wireframe drawing in the wrong thread/place (it can cause crashes)
This commit is contained in:
Erwin Coumans
2019-11-18 10:22:56 -08:00
committed by Xuchen Han
parent 4ee788e2af
commit e5ed15c3b2
10 changed files with 85 additions and 32 deletions

View File

@@ -382,6 +382,8 @@ void btDeformableMultiBodyDynamicsWorld::reinitialize(btScalar timeStep)
void btDeformableMultiBodyDynamicsWorld::debugDrawWorld()
{
btMultiBodyDynamicsWorld::debugDrawWorld();
for (int i = 0; i < getSoftBodyArray().size(); i++)
{
btSoftBody* psb = (btSoftBody*)getSoftBodyArray()[i];
@@ -391,7 +393,7 @@ void btDeformableMultiBodyDynamicsWorld::debugDrawWorld()
}
}
btMultiBodyDynamicsWorld::debugDrawWorld();
}
void btDeformableMultiBodyDynamicsWorld::applyRigidBodyGravity(btScalar timeStep)

View File

@@ -77,6 +77,10 @@ struct btSparseSdf
int nprobes;
int nqueries;
~btSparseSdf()
{
Reset();
}
//
// Methods
//
@@ -330,15 +334,18 @@ struct btSparseSdf
{
struct btS
{
int x, y, z;
int x, y, z, w;
void* p;
};
btS myset;
//memset may be needed in case of additional (uninitialized) padding!
//memset(myset, 0, sizeof(btS));
myset.x = x;
myset.y = y;
myset.z = z;
myset.w = 0;
myset.p = (void*)shape;
const void* ptr = &myset;