also enable depth and segmentation mask preview window in example browser/pybullet

You can disable/enable all preview windows using:

p.configureDebugVisualizer(p.COV_ENABLE_RGB_BUFFER_PREVIEW,0/1)
p.configureDebugVisualizer(p.COV_ENABLE_DEPTH_BUFFER_PREVIEW,0/1)
p.configureDebugVisualizer(p.COV_ENABLE_SEGMENTATION_MASK_PREVIEW,0/1)
This commit is contained in:
erwincoumans
2017-11-17 13:33:27 -08:00
parent e35b0c5643
commit e2d29d4048
3 changed files with 63 additions and 2 deletions

View File

@@ -1752,8 +1752,8 @@ void PhysicsServerExample::initPhysics()
m_canvasRGBIndex = m_canvas->createCanvas("Synthetic Camera RGB data",gCamVisualizerWidth, gCamVisualizerHeight);
//m_canvasDepthIndex = m_canvas->createCanvas("Synthetic Camera Depth data",gCamVisualizerWidth, gCamVisualizerHeight);
//m_canvasSegMaskIndex = m_canvas->createCanvas("Synthetic Camera Segmentation Mask",gCamVisualizerWidth, gCamVisualizerHeight);
m_canvasDepthIndex = m_canvas->createCanvas("Synthetic Camera Depth data",gCamVisualizerWidth, gCamVisualizerHeight);
m_canvasSegMaskIndex = m_canvas->createCanvas("Synthetic Camera Segmentation Mask",gCamVisualizerWidth, gCamVisualizerHeight);
for (int i=0;i<gCamVisualizerWidth;i++)
{
@@ -1898,6 +1898,60 @@ void PhysicsServerExample::updateGraphics()
int flag = m_multiThreadedHelper->m_visualizerFlag;
int enable = m_multiThreadedHelper->m_visualizerEnable;
if (flag == COV_ENABLE_RGB_BUFFER_PREVIEW)
{
if (enable)
{
if (m_canvasRGBIndex<0)
{
m_canvasRGBIndex = m_canvas->createCanvas("Synthetic Camera RGB data",gCamVisualizerWidth, gCamVisualizerHeight);
}
} else
{
if (m_canvasRGBIndex>=0)
{
m_canvas->destroyCanvas(m_canvasRGBIndex);
m_canvasRGBIndex = -1;
}
}
}
if (flag == COV_ENABLE_DEPTH_BUFFER_PREVIEW)
{
if (enable)
{
if (m_canvasDepthIndex<0)
{
m_canvasDepthIndex = m_canvas->createCanvas("Synthetic Camera Depth data",gCamVisualizerWidth, gCamVisualizerHeight);
}
} else
{
if (m_canvasDepthIndex>=0)
{
m_canvas->destroyCanvas(m_canvasDepthIndex);
m_canvasDepthIndex = -1;
}
}
}
if (flag == COV_ENABLE_SEGMENTATION_MARK_PREVIEW)
{
if (enable)
{
if (m_canvasSegMaskIndex<0)
{
m_canvasSegMaskIndex = m_canvas->createCanvas("Synthetic Camera Segmentation Mask",gCamVisualizerWidth, gCamVisualizerHeight);
}
} else
{
if (m_canvasSegMaskIndex>=0)
{
m_canvas->destroyCanvas(m_canvasSegMaskIndex);
m_canvasSegMaskIndex = -1;
}
}
}
if (flag==COV_ENABLE_VR_TELEPORTING)
{
gEnableTeleporting = (enable!=0);

View File

@@ -600,6 +600,10 @@ enum b3ConfigureDebugVisualizerEnum
COV_ENABLE_MOUSE_PICKING,
COV_ENABLE_Y_AXIS_UP,
COV_ENABLE_TINY_RENDERER,
COV_ENABLE_RGB_BUFFER_PREVIEW,
COV_ENABLE_DEPTH_BUFFER_PREVIEW,
COV_ENABLE_SEGMENTATION_MARK_PREVIEW,
};
enum b3AddUserDebugItemEnum