我有3个渲染器显示在1个渲染窗口中,现在我想在前2个渲染器中选择一个点。到目前为止,下面的代码仅适用于src_renderer
。我应该怎么做,以便每个渲染器都有自己的交互?
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->SetSize(1024, 320);
renderWindow->AddRenderer(src_renderer);
renderWindow->AddRenderer(tar_renderer);
renderWindow->AddRenderer(res_renderer);
// An interactor
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow ( renderWindow );
// Set the custom stype to use for interaction.
vtkSmartPointer<MouseInteractorStyle2> src_style = vtkSmartPointer<MouseInteractorStyle2>::New();
vtkSmartPointer<MouseInteractorStyle2> tar_style = vtkSmartPointer<MouseInteractorStyle2>::New();
src_style->SetDefaultRenderer(src_renderer);
tar_style->SetDefaultRenderer(tar_renderer);
renderWindowInteractor->SetInteractorStyle( src_style );