From d95964071d39ded90a0f4ed9499ed89fa59476e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Garc=C3=ADa=20Li=C3=B1=C3=A1n?= Date: Tue, 8 Dec 2020 14:10:24 +0100 Subject: [PATCH] Better handling of near/far values in multiple camera setups --- src/Viewer/CameraGroup.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Viewer/CameraGroup.cxx b/src/Viewer/CameraGroup.cxx index 2d88a3616..ed0d16fa7 100644 --- a/src/Viewer/CameraGroup.cxx +++ b/src/Viewer/CameraGroup.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -256,9 +257,14 @@ void CameraGroup::update(const osg::Vec3d& position, proj_matrix = masterProj * info->projOffset; } + osg::Matrix new_proj_matrix = proj_matrix; + if ((info->flags & CameraInfo::FIXED_NEAR_FAR) == 0) { + makeNewProjMat(proj_matrix, _zNear, _zFar, new_proj_matrix); + } + info->viewMatrix = view_matrix; - info->projMatrix = proj_matrix; - info->compositor->update(view_matrix, proj_matrix); + info->projMatrix = new_proj_matrix; + info->compositor->update(view_matrix, new_proj_matrix); } }