added hierarchical profiling (needs more cleanup)

avoid dynamic allocations in btRaycastVehicle
This commit is contained in:
ejcoumans
2007-11-21 03:00:40 +00:00
parent 89382c0dc4
commit cab75b53ec
19 changed files with 695 additions and 128 deletions

View File

@@ -29,6 +29,9 @@
#include "GLDebugDrawer.h"
static GLDebugDrawer gDebugDrawer;
#include "LinearMath/btQuickProf.h"
CProfileIterator * gProfileIterator=0;
namespace
@@ -80,6 +83,9 @@ DemoApplication* CreatDemo(btDemoEntry* entry)
{
demo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
}
CProfileManager::Reset();
return demo;
}
@@ -107,6 +113,9 @@ void Timer(int)
void SimulationLoop()
{
if (gDrawAabb)
{
demo->setDebugMode(demo->getDebugMode() |btIDebugDraw::DBG_DrawAabb);
@@ -146,10 +155,15 @@ void SimulationLoop()
if (!demo->isIdle())
{
demo->clientMoveAndDisplay();
else
demo->displayCallback();
}
else
{
demo->displayCallback();
}
if (testSelection != testIndex)
{
testIndex = testSelection;
@@ -161,11 +175,24 @@ void SimulationLoop()
viewY = 0.0f;
Resize(width, height);
}
}
}
void Keyboard(unsigned char key, int x, int y)
{
if (key >= 0x31 && key < 0x37)
{
int child = key-0x31;
gProfileIterator->Enter_Child(child);
}
if (key==0x30)
{
gProfileIterator->Enter_Parent();
return;
}
switch (key)
{
case 27:
@@ -211,7 +238,10 @@ void MouseMotion(int x, int y)
int main(int argc, char** argv)
{
gProfileIterator = CProfileManager::Get_Iterator();
int bulletVersion = btGetVersion();
printf("Bullet version %d\n",bulletVersion);