Issue #225: Added cleanup of parts of PhysicEngine.

Added cleanup of CMotionState inserted to RigidBody,
and btSortedOverlappingPairCache inserted to btDbvtBroadphase
in PhysicEngine.
actorid
Lukasz Gromanowski 13 years ago
parent 633e80cded
commit a7ac0e526e

@ -134,10 +134,15 @@ namespace Physic
RigidBody::RigidBody(btRigidBody::btRigidBodyConstructionInfo& CI,std::string name)
:btRigidBody(CI),mName(name)
: btRigidBody(CI)
, mName(name)
{
}
};
RigidBody::~RigidBody()
{
delete getMotionState();
}
@ -155,8 +160,7 @@ namespace Physic
// The actual physics solver
solver = new btSequentialImpulseConstraintSolver;
//TODO: memory leak?
btOverlappingPairCache* pairCache = new btSortedOverlappingPairCache();
pairCache = new btSortedOverlappingPairCache();
//pairCache->setInternalGhostPairCallback( new btGhostPairCallback() );
broadphase = new btDbvtBroadphase(pairCache);
@ -237,6 +241,7 @@ namespace Physic
delete collisionConfiguration;
delete dispatcher;
delete broadphase;
delete pairCache;
delete mShapeLoader;
}

@ -108,7 +108,7 @@ namespace Physic
{
public:
RigidBody(btRigidBody::btRigidBodyConstructionInfo& CI,std::string name);
virtual ~RigidBody() {}
virtual ~RigidBody();
std::string mName;
//is this body used for raycasting only?
@ -211,6 +211,7 @@ namespace Physic
std::list<PhysicEvent> PEventList;
//Bullet Stuff
btOverlappingPairCache* pairCache;
btBroadphaseInterface* broadphase;
btDefaultCollisionConfiguration* collisionConfiguration;
btSequentialImpulseConstraintSolver* solver;

Loading…
Cancel
Save