1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 22:45:34 +00:00

Issue #225: Added cleanup of parts of PhysicEngine.

Added cleanup of CMotionState inserted to RigidBody,
and btSortedOverlappingPairCache inserted to btDbvtBroadphase
in PhysicEngine.
This commit is contained in:
Lukasz Gromanowski 2012-03-25 18:12:00 +02:00
parent 633e80cded
commit a7ac0e526e
2 changed files with 11 additions and 5 deletions

View file

@ -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;
}

View file

@ -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;