demo cleanup part 2 (gimpact memory leaks)
This commit is contained in:
@@ -28,6 +28,9 @@ class GIM_ConvexDecomposition : public ConvexDecomposition::ConvexDecompInterfac
|
||||
protected:
|
||||
btGImpactConvexDecompositionShape * m_compoundShape;
|
||||
|
||||
btAlignedObjectArray<btCollisionShape*> m_convexShapes;
|
||||
|
||||
|
||||
public:
|
||||
int mBaseCount;
|
||||
int mHullCount;
|
||||
@@ -41,6 +44,17 @@ public:
|
||||
m_transformSubShapes = transformSubShapes;
|
||||
}
|
||||
|
||||
virtual ~GIM_ConvexDecomposition()
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<m_convexShapes.size();i++)
|
||||
{
|
||||
btCollisionShape* shape = m_convexShapes[i];
|
||||
delete shape;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
virtual void ConvexDecompResult(ConvexDecomposition::ConvexResult &result)
|
||||
{
|
||||
|
||||
@@ -78,6 +92,7 @@ public:
|
||||
|
||||
btCollisionShape* convexShape = new btConvexHullShape(
|
||||
&(vertices[0].getX()),vertices.size(),sizeof(btVector3));
|
||||
m_convexShapes.push_back(convexShape);
|
||||
|
||||
convexShape->setMargin(m_compoundShape->getMargin());
|
||||
|
||||
@@ -179,18 +194,22 @@ public:
|
||||
|
||||
void btGImpactConvexDecompositionShape::buildConvexDecomposition(bool transformSubShapes)
|
||||
{
|
||||
GIM_ConvexDecomposition decomposition(this,transformSubShapes);
|
||||
|
||||
m_decomposition = new GIM_ConvexDecomposition(this,transformSubShapes);
|
||||
|
||||
int part_count = m_trimeshInterfaces.size();
|
||||
for (int i = 0;i<part_count ;i++ )
|
||||
{
|
||||
decomposition.processDecomposition(i);
|
||||
m_decomposition->processDecomposition(i);
|
||||
}
|
||||
|
||||
postUpdate();
|
||||
}
|
||||
|
||||
|
||||
btGImpactConvexDecompositionShape::~btGImpactConvexDecompositionShape()
|
||||
{
|
||||
delete m_decomposition;
|
||||
}
|
||||
void btGImpactConvexDecompositionShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ class btGImpactConvexDecompositionShape : public btGImpactCompoundShape
|
||||
protected:
|
||||
btAlignedObjectArray<btGImpactMeshShapePart::TrimeshPrimitiveManager> m_trimeshInterfaces;
|
||||
|
||||
class GIM_ConvexDecomposition* m_decomposition;
|
||||
|
||||
void buildConvexDecomposition(bool transformSubShapes);
|
||||
public:
|
||||
|
||||
@@ -63,13 +65,12 @@ public:
|
||||
m_trimeshInterfaces.push_back(triInterface);
|
||||
}
|
||||
|
||||
m_decomposition = 0;
|
||||
|
||||
buildConvexDecomposition(children_has_transform);
|
||||
}
|
||||
|
||||
virtual ~btGImpactConvexDecompositionShape()
|
||||
{
|
||||
}
|
||||
virtual ~btGImpactConvexDecompositionShape();
|
||||
|
||||
SIMD_FORCE_INLINE btGImpactMeshShapePart::TrimeshPrimitiveManager * getTrimeshInterface(int part)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user