Optimize Broad-Phase (#159)
Broad-phase optimization ported from Box2D.
This commit is contained in:
parent
954cf879e7
commit
f555ee4208
51 changed files with 3802 additions and 1830 deletions
|
|
@ -192,6 +192,8 @@ static b3Shape* b3CreateShapeInternal( b3World* world, b3Body* body, b3WorldTran
|
|||
|
||||
if ( shape->type == b3_compoundShape )
|
||||
{
|
||||
world->compoundShapeCount += 1;
|
||||
|
||||
// Own a copy of the compound materials so every shape frees its array the same way. Compounds
|
||||
// are few, so the copy is cheap and avoids aliasing the geometry blob.
|
||||
int materialCount = shape->compound->materialCount;
|
||||
|
|
@ -481,6 +483,12 @@ static void b3DestroyShapeInternal( b3World* world, b3Shape* shape, b3Body* body
|
|||
{
|
||||
int shapeId = shape->id;
|
||||
|
||||
if ( shape->type == b3_compoundShape )
|
||||
{
|
||||
B3_ASSERT( world->compoundShapeCount > 0 );
|
||||
world->compoundShapeCount -= 1;
|
||||
}
|
||||
|
||||
// Remove the shape from the body's doubly linked list.
|
||||
if ( shape->prevShapeId != B3_NULL_INDEX )
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue