initialize time-step statistics in a world; rename profile function

This commit is contained in:
Irlan
2018-04-26 23:51:20 -03:00
parent 16d351ecac
commit cd6c7e188a
5 changed files with 47 additions and 40 deletions

View File

@@ -25,14 +25,24 @@
#include <bounce/dynamics/joints/joint.h>
#include <bounce/dynamics/time_step.h>
extern u32 b3_allocCalls;
extern u32 b3_maxAllocCalls;
extern u32 b3_allocCalls, b3_maxAllocCalls;
extern u32 b3_convexCalls, b3_convexCacheHits;
extern u32 b3_gjkCalls, b3_gjkIters, b3_gjkMaxIters;
extern bool b3_convexCache;
b3World::b3World() : m_bodyBlocks(sizeof(b3Body))
{
b3_allocCalls = 0;
b3_maxAllocCalls = 0;
b3_gjkCalls = 0;
b3_gjkIters = 0;
b3_convexCalls = 0;
b3_convexCacheHits = 0;
b3_convexCache = true;
m_flags = e_clearForcesFlag;
m_sleeping = false;
m_warmStarting = true;
@@ -49,8 +59,15 @@ b3World::~b3World()
b->DestroyJoints();
b = b->m_next;
}
b3_allocCalls = 0;
b3_maxAllocCalls = 0;
b3_gjkCalls = 0;
b3_gjkIters = 0;
b3_convexCalls = 0;
b3_convexCacheHits = 0;
}
void b3World::SetSleeping(bool flag)
@@ -98,6 +115,16 @@ void b3World::Step(float32 dt, u32 velocityIterations, u32 positionIterations)
{
B3_PROFILE("Step");
// Clear statistics
b3_allocCalls = 0;
b3_convexCalls = 0;
b3_convexCacheHits = 0;
b3_gjkCalls = 0;
b3_gjkIters = 0;
b3_gjkMaxIters = 0;
if (m_flags & e_shapeAddedFlag)
{
// If new shapes were added new contacts might be created.