Add a btIDEbugDraw::clearLines, helps multi-threaded rendering of lines (while updating those lines in a dynamics world in a different thread)

Expose COV_ENABLE_VR_RENDER_CONTROLLERS, to enable/disable rendering of controllers (and some frames) in VR
Expose COV_ENABLE_RENDERING to enable/disable rendering.
Fix some multi-threading issues (potential crashes), related to debug drawing/rendering in one thread, while changing the dynamics world/removing/resetSimulation in a different thread.
This commit is contained in:
Erwin Coumans
2017-05-16 12:19:03 -07:00
parent 4dea68e43e
commit 433d11d8cf
24 changed files with 354 additions and 110 deletions

View File

@@ -4216,10 +4216,12 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
case CMD_RESET_SIMULATION:
{
BT_PROFILE("CMD_RESET_SIMULATION");
m_data->m_guiHelper->setVisualizerFlag(COV_ENABLE_SYNC_RENDERING_INTERNAL,0);
resetSimulation();
m_data->m_guiHelper->setVisualizerFlag(COV_ENABLE_SYNC_RENDERING_INTERNAL,1);
SharedMemoryStatus& serverCmd =serverStatusOut;
serverCmd.m_type = CMD_RESET_SIMULATION_COMPLETED;
hasStatus = true;
@@ -5062,6 +5064,8 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
serverCmd.m_removeObjectArgs.m_numBodies = 0;
serverCmd.m_removeObjectArgs.m_numUserConstraints = 0;
m_data->m_guiHelper->setVisualizerFlag(COV_ENABLE_SYNC_RENDERING_INTERNAL,0);
for (int i=0;i<clientCmd.m_removeObjectArgs.m_numBodies;i++)
{
int bodyUniqueId = clientCmd.m_removeObjectArgs.m_bodyUniqueIds[i];
@@ -5142,7 +5146,8 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
m_data->m_bodyHandles.freeHandle(bodyUniqueId);
}
m_data->m_guiHelper->setVisualizerFlag(COV_ENABLE_SYNC_RENDERING_INTERNAL,1);
hasStatus = true;
break;
@@ -5929,11 +5934,14 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
//static int skip=1;
void PhysicsServerCommandProcessor::renderScene()
void PhysicsServerCommandProcessor::renderScene(int renderFlags)
{
if (m_data->m_guiHelper)
{
m_data->m_guiHelper->syncPhysicsToGraphics(m_data->m_dynamicsWorld);
if (0==(renderFlags&COV_DISABLE_SYNC_RENDERING))
{
m_data->m_guiHelper->syncPhysicsToGraphics(m_data->m_dynamicsWorld);
}
m_data->m_guiHelper->render(m_data->m_dynamicsWorld);
}
#ifdef USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD