From 107230f31b7eaf12eda82092a9552ba9063ab796 Mon Sep 17 00:00:00 2001 From: Bas Ruigrok Date: Sat, 5 Jul 2025 12:37:47 +0200 Subject: [PATCH] Gui: Increase orthographicFocalDistance to get more near and far distance slack --- src/Gui/Navigation/NavigationStyle.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Gui/Navigation/NavigationStyle.cpp b/src/Gui/Navigation/NavigationStyle.cpp index e312803d19..8cfd690401 100644 --- a/src/Gui/Navigation/NavigationStyle.cpp +++ b/src/Gui/Navigation/NavigationStyle.cpp @@ -722,7 +722,14 @@ void NavigationStyle::reorientCamera(SoCamera* camera, const SbRotation& rotatio SbVec3f direction; camera->orientation.getValue().multVec(SbVec3f(0, 0, -1), direction); +#if (COIN_MAJOR_VERSION * 100 + COIN_MINOR_VERSION * 10 + COIN_MICRO_VERSION < 405) + // Large focal distance puts the camera far away which causes Coin's auto clipping + // calculations to add more slack (more space between near and far plane) and thus reduces + // chances or hidden geometry. + constexpr float orthographicFocalDistance = 250; +#else constexpr float orthographicFocalDistance = 1; +#endif camera->position = getFocalPoint() - orthographicFocalDistance * direction; camera->focalDistance = orthographicFocalDistance; }