forked from mirror/openmw-tes3mp
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:
parent
633e80cded
commit
a7ac0e526e
2 changed files with 11 additions and 5 deletions
|
@ -134,10 +134,15 @@ namespace Physic
|
||||||
|
|
||||||
|
|
||||||
RigidBody::RigidBody(btRigidBody::btRigidBodyConstructionInfo& CI,std::string name)
|
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
|
// The actual physics solver
|
||||||
solver = new btSequentialImpulseConstraintSolver;
|
solver = new btSequentialImpulseConstraintSolver;
|
||||||
|
|
||||||
//TODO: memory leak?
|
pairCache = new btSortedOverlappingPairCache();
|
||||||
btOverlappingPairCache* pairCache = new btSortedOverlappingPairCache();
|
|
||||||
//pairCache->setInternalGhostPairCallback( new btGhostPairCallback() );
|
//pairCache->setInternalGhostPairCallback( new btGhostPairCallback() );
|
||||||
|
|
||||||
broadphase = new btDbvtBroadphase(pairCache);
|
broadphase = new btDbvtBroadphase(pairCache);
|
||||||
|
@ -237,6 +241,7 @@ namespace Physic
|
||||||
delete collisionConfiguration;
|
delete collisionConfiguration;
|
||||||
delete dispatcher;
|
delete dispatcher;
|
||||||
delete broadphase;
|
delete broadphase;
|
||||||
|
delete pairCache;
|
||||||
delete mShapeLoader;
|
delete mShapeLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace Physic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RigidBody(btRigidBody::btRigidBodyConstructionInfo& CI,std::string name);
|
RigidBody(btRigidBody::btRigidBodyConstructionInfo& CI,std::string name);
|
||||||
virtual ~RigidBody() {}
|
virtual ~RigidBody();
|
||||||
std::string mName;
|
std::string mName;
|
||||||
|
|
||||||
//is this body used for raycasting only?
|
//is this body used for raycasting only?
|
||||||
|
@ -211,6 +211,7 @@ namespace Physic
|
||||||
std::list<PhysicEvent> PEventList;
|
std::list<PhysicEvent> PEventList;
|
||||||
|
|
||||||
//Bullet Stuff
|
//Bullet Stuff
|
||||||
|
btOverlappingPairCache* pairCache;
|
||||||
btBroadphaseInterface* broadphase;
|
btBroadphaseInterface* broadphase;
|
||||||
btDefaultCollisionConfiguration* collisionConfiguration;
|
btDefaultCollisionConfiguration* collisionConfiguration;
|
||||||
btSequentialImpulseConstraintSolver* solver;
|
btSequentialImpulseConstraintSolver* solver;
|
||||||
|
|
Loading…
Reference in a new issue