First attempt at implementing Memoization for certain Box2D objects

--HG--
branch : box2d-update
This commit is contained in:
Bill Meltsner
2011-09-24 12:20:59 -04:00
parent d35dbaa28b
commit c705063597
11 changed files with 69 additions and 0 deletions
+11
View File
@@ -25,6 +25,8 @@
#include "World.h"
#include "Physics.h"
#include <common/Memoizer.h>
// STD
#include <bitset>
@@ -38,9 +40,18 @@ namespace box2d
: shape(NULL)
{
}
Shape::Shape(b2Shape * shape)
: shape(shape)
{
Memoizer::add(shape, this);
}
Shape::~Shape()
{
if (shape) {
Memoizer::remove(shape);
delete shape;
}
shape = 0;
}