Add pybullet.configureDebugVisualizer(rgbBackground=[red,green,blue]) (each component a float in the range [0,1])

This is an alternative to passing options="--background_color_red=red --background_color_green=green --background_color_blue=blue" in the connect method.
This commit is contained in:
erwin coumans
2021-05-06 18:08:22 -07:00
parent 8e85dedaa9
commit e952ac6f63
13 changed files with 73 additions and 7 deletions

View File

@@ -133,6 +133,7 @@ enum MultiThreadedGUIHelperCommunicationEnums
eGUIUserDebugRemoveAllParameters,
eGUIHelperResetCamera,
eGUIHelperChangeGraphicsInstanceFlags,
eGUIHelperSetRgbBackground,
};
#include <stdio.h>
@@ -1058,7 +1059,17 @@ public:
workerThreadWait();
}
double m_rgbBackground[3];
virtual void setBackgroundColor(const double rgbBackground[3])
{
m_rgbBackground[0] = rgbBackground[0];
m_rgbBackground[1] = rgbBackground[1];
m_rgbBackground[2] = rgbBackground[2];
m_cs->lock();
m_cs->setSharedParam(1, eGUIHelperSetRgbBackground);
workerThreadWait();
this->getRenderInterface()->setBackgroundColor(rgbBackground);
}
int m_graphicsInstanceChangeScaling;
@@ -2267,6 +2278,13 @@ void PhysicsServerExample::updateGraphics()
break;
}
case eGUIHelperSetRgbBackground:
{
m_multiThreadedHelper->m_childGuiHelper->setBackgroundColor(m_multiThreadedHelper->m_rgbBackground);
m_multiThreadedHelper->mainThreadRelease();
break;
}
case eGUIHelperChangeGraphicsInstanceScaling:
{
B3_PROFILE("eGUIHelperChangeGraphicsInstanceScaling");