/**
 * Connects a VTK renderer with a vtk renderwindow. The renderer will be rendered between background renderers and
 * foreground renderers.
 */
void mitk::VtkLayerController::InsertSceneRenderer(vtkSmartPointer<vtkRenderer> renderer)
{
  if (renderer == nullptr)
    return;

  // Remove renderer if it already exists
  RemoveRenderer(renderer);

  m_SceneRenderers.push_back(renderer);
  UpdateLayers();
}
void SjVisImpl::SetRenderer(SjVisRendererModule* rendererModule, bool justContinue)
{
	wxASSERT( wxThread::IsMain() );

	if( rendererModule )
	{
		// set a new renderer
		RemoveRenderer();
		CalcPositions();

		// load the renderer
		if( rendererModule->Load() )
		{
			m_renderer = rendererModule;
			rendererModule->Start(this, justContinue);
		}
	}
	else
	{
		// remove an exiting renderer
		RemoveRenderer();
		wxASSERT( m_renderer == NULL );
	}
}
/**
 * Connects a VTK renderer with a vtk renderwindow. The renderer will be rendered in the background.
 * With forceAbsoluteBackground set true a renderer can be placed at the absolute background of the scene.
 * Multiple calls with forceAbsoluteBackground set true will set the latest registered renderer as background.
 */
void mitk::VtkLayerController::InsertBackgroundRenderer(vtkSmartPointer<vtkRenderer> renderer,
                                                        bool forceAbsoluteBackground)
{
  if (renderer == nullptr)
    return;

  // Remove renderer if it already exists
  RemoveRenderer(renderer);

  if (forceAbsoluteBackground)
  {
    auto it = m_BackgroundRenderers.begin();
    m_BackgroundRenderers.insert(it, renderer);
  }
  else
    m_BackgroundRenderers.push_back(renderer);
  UpdateLayers();
}
void SjVisImpl::Exit()
{
	RemoveRenderer();
	wxASSERT( m_renderer == NULL );
}
 void MediaStreamTrack::RemoveVideoRenderer(webrtc::VideoRendererInterface & renderer) {
     auto inner_track = inner_video_track();
     if (!inner_track) { Fatal("not video track"); }
     inner_track->RemoveRenderer(&renderer);
 }