소스 검색

Merge pull request #720 from lassoan/sliceview-overlay-warp

BUG: Fixed warped widgets in ctkVTKSliceView overlay
Julien Finet 8 년 전
부모
커밋
9e6df18327
2개의 변경된 파일15개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.cpp
  2. 7 0
      Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp

+ 8 - 0
Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.cpp

@@ -373,6 +373,14 @@ void vtkLightBoxRendererManager::vtkInternal::setupRendering()
       // Add to RenderWindow
       this->RenderWindow->AddRenderer(item->Renderer);
 
+      // Parallel projection is needed to prevent actors from warping/tilting
+      // when they are near the edge of the window.
+      vtkCamera* camera = item->Renderer->GetActiveCamera();
+      if (camera)
+        {
+        camera->ParallelProjectionOn();
+        }
+
       xMin += viewportWidth;
       }
     }

+ 7 - 0
Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp

@@ -70,6 +70,13 @@ void ctkVTKSliceViewPrivate::setupRendering()
   // Setup overlay renderer
   this->OverlayRenderer->SetLayer(1);
   this->RenderWindow->AddRenderer(this->OverlayRenderer);
+  // Parallel projection is needed to prevent actors from warping/tilting
+  // when they are near the edge of the window.
+  vtkCamera* camera = this->OverlayRenderer->GetActiveCamera();
+  if (camera)
+    {
+    camera->ParallelProjectionOn();
+    }
 
   // Create cornerAnnotation and set its default property
   this->OverlayCornerAnnotation = vtkSmartPointer<vtkCornerAnnotation>::New();