improve pybullet performance of loadURDF/SDF/MJCF and 'createCollisionShape'/'createMultiBody' for GUI/VR/SHARED_MEMORY,
use p.configureDebugVisualizer(p.COV_ENABLE_RENDERING,0) before loading and p.configureDebugVisualizer(p.COV_ENABLE_RENDERING,1) afterwards
This commit is contained in:
@@ -230,6 +230,7 @@ static double gMinUpdateTimeMicroSecs = 4000.;
|
||||
|
||||
void ExampleBrowserThreadFunc(void* userPtr,void* lsMemory)
|
||||
{
|
||||
|
||||
printf("ExampleBrowserThreadFunc started\n");
|
||||
|
||||
ExampleBrowserThreadLocalStorage* localStorage = (ExampleBrowserThreadLocalStorage*) lsMemory;
|
||||
@@ -257,7 +258,9 @@ void ExampleBrowserThreadFunc(void* userPtr,void* lsMemory)
|
||||
|
||||
do
|
||||
{
|
||||
B3_PROFILE("ExampleBrowserThreadFunc");
|
||||
clock.usleep(0);
|
||||
|
||||
//B3_PROFILE("ExampleBrowserThreadFunc");
|
||||
float deltaTimeInSeconds = clock.getTimeMicroseconds()/1000000.f;
|
||||
{
|
||||
if (deltaTimeInSeconds > 0.1)
|
||||
@@ -266,13 +269,13 @@ void ExampleBrowserThreadFunc(void* userPtr,void* lsMemory)
|
||||
}
|
||||
if (deltaTimeInSeconds < (gMinUpdateTimeMicroSecs/1e6))
|
||||
{
|
||||
B3_PROFILE("clock.usleep");
|
||||
clock.usleep(gMinUpdateTimeMicroSecs/10.);
|
||||
//B3_PROFILE("clock.usleep");
|
||||
exampleBrowser->updateGraphics();
|
||||
} else
|
||||
{
|
||||
B3_PROFILE("exampleBrowser->update");
|
||||
//B3_PROFILE("exampleBrowser->update");
|
||||
clock.reset();
|
||||
exampleBrowser->updateGraphics();
|
||||
exampleBrowser->update(deltaTimeInSeconds);
|
||||
}
|
||||
}
|
||||
@@ -429,6 +432,7 @@ void btUpdateInProcessExampleBrowserMainThread(btInProcessExampleBrowserMainThre
|
||||
{
|
||||
float deltaTimeInSeconds = data->m_clock.getTimeMicroseconds()/1000000.f;
|
||||
data->m_clock.reset();
|
||||
data->m_exampleBrowser->updateGraphics();
|
||||
data->m_exampleBrowser->update(deltaTimeInSeconds);
|
||||
}
|
||||
void btShutDownExampleBrowserMainThread(btInProcessExampleBrowserMainThreadInternalData* data)
|
||||
|
||||
@@ -127,6 +127,8 @@ extern bool useShadowMap;
|
||||
bool visualWireframe=false;
|
||||
static bool renderVisualGeometry=true;
|
||||
static bool renderGrid = true;
|
||||
static bool gEnableRenderLoop = true;
|
||||
|
||||
bool renderGui = true;
|
||||
static bool enable_experimental_opencl = false;
|
||||
|
||||
@@ -370,6 +372,10 @@ void OpenGLExampleBrowser::registerFileImporter(const char* extension, CommonExa
|
||||
|
||||
void OpenGLExampleBrowserVisualizerFlagCallback(int flag, bool enable)
|
||||
{
|
||||
if (flag == COV_ENABLE_RENDERING)
|
||||
{
|
||||
gEnableRenderLoop = (enable!=0);
|
||||
}
|
||||
if (flag == COV_ENABLE_SHADOWS)
|
||||
{
|
||||
useShadowMap = enable;
|
||||
@@ -1185,7 +1191,7 @@ void OpenGLExampleBrowser::updateGraphics()
|
||||
{
|
||||
if (!pauseSimulation || singleStepSimulation)
|
||||
{
|
||||
B3_PROFILE("sCurrentDemo->updateGraphics");
|
||||
//B3_PROFILE("sCurrentDemo->updateGraphics");
|
||||
sCurrentDemo->updateGraphics();
|
||||
}
|
||||
}
|
||||
@@ -1193,6 +1199,9 @@ void OpenGLExampleBrowser::updateGraphics()
|
||||
|
||||
void OpenGLExampleBrowser::update(float deltaTime)
|
||||
{
|
||||
if (!gEnableRenderLoop)
|
||||
return;
|
||||
|
||||
b3ChromeUtilsEnableProfiling();
|
||||
|
||||
B3_PROFILE("OpenGLExampleBrowser::update");
|
||||
|
||||
Reference in New Issue
Block a user