changes in debug drawing, thanks to Dennis Cappendijk

See Issue 559
This commit is contained in:
erwin.coumans
2012-02-29 04:15:09 +00:00
parent 1bcfd824f2
commit b90352d62b
6 changed files with 36 additions and 20 deletions

View File

@@ -53,6 +53,7 @@ namespace
int tx, ty, tw, th;
int gDrawAabb;
int gWireFrame;
int gDrawNormals;
int gHelpText;
int gDebugConstraints;
int gDebugContacts;
@@ -81,6 +82,7 @@ void setDefaultSettings()
height = 768;//480;
iterationCount = 10;
gDrawAabb=0;
gDrawNormals=0;
gWireFrame=0;
gDebugContacts=0;
//enable constraint debug visualization for first demo, only if user hasn't overridden the setting
@@ -226,7 +228,13 @@ void SimulationLoop()
} else
{
demo->setDebugMode(demo->getDebugMode() & (~btIDebugDraw::DBG_DrawWireframe));
}
if (gDrawNormals)
{
demo->setDebugMode(demo->getDebugMode() |btIDebugDraw::DBG_DrawNormals);
} else
{
demo->setDebugMode(demo->getDebugMode() & (~btIDebugDraw::DBG_DrawNormals));
}
if (gHelpText)
{
@@ -327,7 +335,7 @@ void SimulationLoop()
gDebugConstraints=0;
} else
{
gDebugConstraints=1;
gDebugConstraints=1;
}
testIndex = testSelection;
@@ -531,6 +539,7 @@ int main(int argc, char** argv)
glui->add_checkbox_to_panel(drawPanel, "Help", &gHelpText);
glui->add_checkbox_to_panel(drawPanel, "AABBs", &gDrawAabb);
glui->add_checkbox_to_panel(drawPanel, "Wireframe", &gWireFrame);
glui->add_checkbox_to_panel(drawPanel, "Normals", &gDrawNormals);
glui->add_checkbox_to_panel(drawPanel, "Contacts", &gDebugContacts);
glui->add_checkbox_to_panel(drawPanel, "Constraints", &gDebugConstraints);

View File

@@ -101,7 +101,7 @@ void CharacterDemo::initPhysics()
btTransform tr;
tr.setIdentity();
char* bspfilename = "BspDemo.bsp";
const char* bspfilename = "BspDemo.bsp";
void* memoryBuffer = 0;
FILE* file = fopen(bspfilename,"r");

View File

@@ -391,6 +391,12 @@ void DemoApplication::keyboardCallback(unsigned char key, int x, int y)
else
m_debugMode |= btIDebugDraw::DBG_DisableBulletLCP;
break;
case 'N':
if (m_debugMode & btIDebugDraw::DBG_DrawNormals)
m_debugMode = m_debugMode & (~btIDebugDraw::DBG_DrawNormals);
else
m_debugMode |= btIDebugDraw::DBG_DrawNormals;
break;
case 't' :
if (m_debugMode & btIDebugDraw::DBG_DrawText)