mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 09:15:33 +00:00
Issue #225: Added cleanup of allocated memory in BulletNifLoader and BulletShapeLoader.
This commit is contained in:
parent
a7ac0e526e
commit
d3b88b9e34
3 changed files with 22 additions and 3 deletions
|
@ -51,7 +51,11 @@ using namespace Mangle::VFS;
|
||||||
|
|
||||||
using namespace NifBullet;
|
using namespace NifBullet;
|
||||||
|
|
||||||
//====================================================================================================
|
ManualBulletShapeLoader::~ManualBulletShapeLoader()
|
||||||
|
{
|
||||||
|
delete vfs;
|
||||||
|
}
|
||||||
|
|
||||||
Ogre::Matrix3 ManualBulletShapeLoader::getMatrix(Nif::Transformation* tr)
|
Ogre::Matrix3 ManualBulletShapeLoader::getMatrix(Nif::Transformation* tr)
|
||||||
{
|
{
|
||||||
Ogre::Matrix3 rot(tr->rotation.v[0].array[0],tr->rotation.v[0].array[1],tr->rotation.v[0].array[2],
|
Ogre::Matrix3 rot(tr->rotation.v[0].array[0],tr->rotation.v[0].array[1],tr->rotation.v[0].array[2],
|
||||||
|
@ -135,7 +139,21 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||||
handleNode(node,0,Ogre::Matrix3::IDENTITY,Ogre::Vector3::ZERO,1,hasCollisionNode,false,true);
|
handleNode(node,0,Ogre::Matrix3::IDENTITY,Ogre::Vector3::ZERO,1,hasCollisionNode,false,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentShape = new btBvhTriangleMeshShape(mTriMesh,true);
|
struct TriangleMeshShape : public btBvhTriangleMeshShape
|
||||||
|
{
|
||||||
|
TriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression)
|
||||||
|
: btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~TriangleMeshShape()
|
||||||
|
{
|
||||||
|
delete getTriangleInfoMap();
|
||||||
|
delete m_meshInterface;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
currentShape = new TriangleMeshShape(mTriMesh,true);
|
||||||
cShape->Shape = currentShape;
|
cShape->Shape = currentShape;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ class ManualBulletShapeLoader : public BulletShapeLoader
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ManualBulletShapeLoader():resourceGroup("General"){vfs = 0;}
|
ManualBulletShapeLoader():resourceGroup("General"){vfs = 0;}
|
||||||
virtual ~ManualBulletShapeLoader() {}
|
virtual ~ManualBulletShapeLoader();
|
||||||
|
|
||||||
void warn(std::string msg)
|
void warn(std::string msg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@ Ogre::Resource(creator, name, handle, group, isManual, loader)
|
||||||
|
|
||||||
BulletShape::~BulletShape()
|
BulletShape::~BulletShape()
|
||||||
{
|
{
|
||||||
|
deleteShape(Shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
// farm out to BulletShapeLoader
|
// farm out to BulletShapeLoader
|
||||||
|
|
Loading…
Reference in a new issue