Fix clipping near camera in orthogonal view

Fix #6836
This commit is contained in:
Jolbas
2023-05-30 18:14:43 +02:00
committed by Adrián Insaurralde Avalos
parent edf1bbf6f4
commit 7fdfdcde49

View File

@@ -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<SoOrthographicCamera*>(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;