From 7fdfdcde491a6085b232b6ac72717fb403c6b15e Mon Sep 17 00:00:00 2001 From: Jolbas <39026960+Jolbas@users.noreply.github.com> Date: Tue, 30 May 2023 18:14:43 +0200 Subject: [PATCH] Fix clipping near camera in orthogonal view Fix #6836 --- src/Gui/NavigationStyle.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Gui/NavigationStyle.cpp b/src/Gui/NavigationStyle.cpp index b34ee7682b..a63abb399c 100644 --- a/src/Gui/NavigationStyle.cpp +++ b/src/Gui/NavigationStyle.cpp @@ -622,7 +622,10 @@ void NavigationStyle::reorientCamera(SoCamera * cam, const SbRotation & rot) // Set new orientation value by accumulating the new rotation. cam->orientation = rot * cam->orientation.getValue(); - + // Fix issue with near clipping in orthogonal view + if (cam->getTypeId().isDerivedFrom(SoOrthographicCamera::getClassTypeId())) { + cam->focalDistance = static_cast(cam)->height; + } // Reposition camera so we are still pointing at the same old focal point. cam->orientation.getValue().multVec(SbVec3f(0, 0, -1), direction); cam->position = focalpoint - cam->focalDistance.getValue() * direction;