From 723ef3711245941ca3548e21a289b027f641c1b0 Mon Sep 17 00:00:00 2001 From: Sankhesh Jhaveri Date: Mon, 13 Oct 2014 10:38:38 -0400 Subject: [PATCH] FIX: Reset clipping planes This fixes the issue where the clipping plane is still active after the camera dollies out of the volume. The check looks at whether the camera was inside the volume in the last frame and if the geometry needs to be updated. Change-Id: Idfc6a87f57ec623044d247c49703d45fc2e47f3f --- .../VolumeOpenGLNew/vtkOpenGLGPUVolumeRayCastMapper.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Rendering/VolumeOpenGLNew/vtkOpenGLGPUVolumeRayCastMapper.cxx b/Rendering/VolumeOpenGLNew/vtkOpenGLGPUVolumeRayCastMapper.cxx index cc6123c2cc4..c90c0a45c7e 100644 --- a/Rendering/VolumeOpenGLNew/vtkOpenGLGPUVolumeRayCastMapper.cxx +++ b/Rendering/VolumeOpenGLNew/vtkOpenGLGPUVolumeRayCastMapper.cxx @@ -80,6 +80,7 @@ class vtkOpenGLGPUVolumeRayCastMapper::vtkInternal this->Initialized = false; this->ValidTransferFunction = false; this->LoadDepthTextureExtensionsSucceeded = false; + this->CameraWasInsideInLastUpdate = false; this->CubeVBOId = 0; #ifndef __APPLE__ this->CubeVAOId = 0; @@ -246,6 +247,7 @@ class vtkOpenGLGPUVolumeRayCastMapper::vtkInternal bool Initialized; bool ValidTransferFunction; bool LoadDepthTextureExtensionsSucceeded; + bool CameraWasInsideInLastUpdate; GLuint CubeVBOId; #ifndef __APPLE__ @@ -1086,7 +1088,8 @@ bool vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::IsCameraInside( void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateVolumeGeometry( vtkRenderer* ren, vtkVolume* vol, vtkImageData* input) { - if (input != this->PrevInput || this->IsCameraInside(ren, vol)) + if (input != this->PrevInput || this->IsCameraInside(ren, vol) || + this->CameraWasInsideInLastUpdate) { vtkNew boxSource; boxSource->SetBounds(this->LoadedBounds); @@ -1203,10 +1206,13 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateVolumeGeometry( clip->SetPlanes(planes.GetPointer()); densityPolyData->SetInputConnection(clip->GetOutputPort()); + + this->CameraWasInsideInLastUpdate = true; } else { densityPolyData->SetInputConnection(boxSource->GetOutputPort()); + this->CameraWasInsideInLastUpdate = false; } densityPolyData->SetNumberOfSubdivisions(2);