From 54c8375672e52160e39df860b50ad02a45828806 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 11 May 2021 16:34:02 +0400 Subject: [PATCH] Recreate a special case for IntersectionVisitor on QuadTreeWorld --- components/terrain/viewdata.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/terrain/viewdata.cpp b/components/terrain/viewdata.cpp index 48e882ea7..996bf909c 100644 --- a/components/terrain/viewdata.cpp +++ b/components/terrain/viewdata.cpp @@ -143,7 +143,7 @@ ViewData *ViewDataMap::getViewData(osg::Object *viewer, const osg::Vec3f& viewPo if (!vd->suitableToUse(activeGrid) || (vd->getViewPoint()-viewPoint).length2() >= mReuseDistance*mReuseDistance || vd->getWorldUpdateRevision() < mWorldUpdateRevision) { - float shortestDist = mReuseDistance*mReuseDistance; + float shortestDist = viewer ? mReuseDistance*mReuseDistance : std::numeric_limits::max(); const ViewData* mostSuitableView = nullptr; for (const ViewData* other : mUsedViews) { @@ -157,12 +157,12 @@ ViewData *ViewDataMap::getViewData(osg::Object *viewer, const osg::Vec3f& viewPo } } } - if (mostSuitableView) + if (mostSuitableView && mostSuitableView != vd) { vd->copyFrom(*mostSuitableView); return vd; } - else + else if (!mostSuitableView) { vd->setViewPoint(viewPoint); needsUpdate = true;