Commit 418bb953 authored by Alexis Girault's avatar Alexis Girault
Browse files

BUG: render in setRenderingMode if viewer running

1) Only update the renderWindow in setRenderingMode if
the viewer is up and running

2) Do not set a renderMode when setting a new current
scene if the viewer is not yet rendering.
parent 8accb733
...@@ -131,14 +131,27 @@ SimulationManager::setCurrentScene(std::string newSceneName, bool unloadCurrentS ...@@ -131,14 +131,27 @@ SimulationManager::setCurrentScene(std::string newSceneName, bool unloadCurrentS
return; return;
} }
// Update viewer // Update viewer scene
m_viewer->setCurrentScene(newScene); m_viewer->setCurrentScene(newScene);
// If not yet rendering: update current scene and return
if(!m_viewer->isRendering())
{
m_currentSceneName = newSceneName;
return;
}
// If rendering and simulation not active:
// render scene in debug, update current scene, and return
if (m_status == SimulationStatus::INACTIVE) if (m_status == SimulationStatus::INACTIVE)
{ {
m_viewer->setRenderingMode(Renderer::Mode::DEBUG); m_viewer->setRenderingMode(Renderer::Mode::DEBUG);
m_currentSceneName = newSceneName; m_currentSceneName = newSceneName;
return; return;
} }
// If rendering and simulation active:
// render scene in simulation mode, and update simulation
m_viewer->setRenderingMode(Renderer::Mode::SIMULATION); m_viewer->setRenderingMode(Renderer::Mode::SIMULATION);
// Stop/Pause running scene // Stop/Pause running scene
...@@ -195,6 +208,11 @@ SimulationManager::startSimulation(bool debug) ...@@ -195,6 +208,11 @@ SimulationManager::startSimulation(bool debug)
this->startModuleInNewThread(startingScene); this->startModuleInNewThread(startingScene);
m_status = SimulationStatus::RUNNING; m_status = SimulationStatus::RUNNING;
} }
// Start Debug
else
{
m_viewer->setRenderingMode(Renderer::Mode::DEBUG);
}
// Start Rendering // Start Rendering
if( !m_viewer->isRendering() ) if( !m_viewer->isRendering() )
......
...@@ -80,6 +80,12 @@ Viewer::setRenderingMode(Renderer::Mode mode) ...@@ -80,6 +80,12 @@ Viewer::setRenderingMode(Renderer::Mode mode)
// Setup renderer // Setup renderer
m_rendererMap.at(m_currentScene)->setup(mode); m_rendererMap.at(m_currentScene)->setup(mode);
if( !m_running )
{
return;
}
// Render to update displayed actors
m_vtkRenderWindow->Render(); m_vtkRenderWindow->Render();
// Setup render window // Setup render window
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment