|
|
|
@ -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<float>::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;
|
|
|
|
|