Commit 6ebedcdf authored by Alexis Girault's avatar Alexis Girault
Browse files

ENH: Implement Viewer::getCurrentRenderer

parent b5a57f0f
......@@ -45,7 +45,7 @@ Viewer::setCurrentScene(std::shared_ptr<Scene>scene)
// If the current scene has a renderer, remove it
if( m_currentScene )
{
auto vtkRenderer = m_rendererMap.at(m_currentScene)->getVtkRenderer();
auto vtkRenderer = this->getCurrentRenderer()->getVtkRenderer();
if(m_vtkRenderWindow->HasRenderer(vtkRenderer))
{
m_vtkRenderWindow->RemoveRenderer(vtkRenderer);
......@@ -62,12 +62,18 @@ Viewer::setCurrentScene(std::shared_ptr<Scene>scene)
}
// Set renderer to renderWindow
m_vtkRenderWindow->AddRenderer(m_rendererMap.at(m_currentScene)->getVtkRenderer());
m_vtkRenderWindow->AddRenderer(this->getCurrentRenderer()->getVtkRenderer());
// Set name to renderWindow
m_vtkRenderWindow->SetWindowName(m_currentScene->getName().data());
}
std::shared_ptr<Renderer>
Viewer::getCurrentRenderer() const
{
return m_rendererMap.at(m_currentScene);
}
void
Viewer::setRenderingMode(Renderer::Mode mode)
{
......@@ -79,7 +85,7 @@ Viewer::setRenderingMode(Renderer::Mode mode)
}
// Setup renderer
m_rendererMap.at(m_currentScene)->setup(mode);
this->getCurrentRenderer()->setup(mode);
if( !m_running )
{
return;
......
......@@ -54,6 +54,8 @@ public:
std::shared_ptr<Scene> getCurrentScene() const;
void setCurrentScene(std::shared_ptr<Scene>scene);
std::shared_ptr<Renderer> getCurrentRenderer() const;
void setRenderingMode(Renderer::Mode mode);
void startRenderingLoop();
void endRenderingLoop();
......@@ -64,9 +66,6 @@ public:
protected:
void debugModeKeyPressCallback(vtkObject*, long unsigned int, void*);
void simulationModeKeyPressCallback(vtkObject*, long unsigned int, void*);
vtkSmartPointer<vtkRenderWindow> m_vtkRenderWindow = vtkSmartPointer<vtkRenderWindow>::New();
vtkSmartPointer<InteractorStyle> m_interactorStyle = vtkSmartPointer<InteractorStyle>::New();
std::shared_ptr<Scene> m_currentScene;
......
Markdown is supported
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