|
|
|
@ -141,9 +141,9 @@ ViewData *ViewDataMap::getViewData(osg::Object *viewer, const osg::Vec3f& viewPo
|
|
|
|
|
vd = found->second;
|
|
|
|
|
needsUpdate = false;
|
|
|
|
|
|
|
|
|
|
if (!(vd->suitableToUse(activeGrid) && (vd->getViewPoint()-viewPoint).length2() < mReuseDistance*mReuseDistance && vd->getWorldUpdateRevision() >= mWorldUpdateRevision))
|
|
|
|
|
if (!vd->suitableToUse(activeGrid) || (vd->getViewPoint()-viewPoint).length2() >= mReuseDistance*mReuseDistance || vd->getWorldUpdateRevision() < mWorldUpdateRevision)
|
|
|
|
|
{
|
|
|
|
|
float shortestDist = std::numeric_limits<float>::max();
|
|
|
|
|
float shortestDist = mReuseDistance*mReuseDistance;
|
|
|
|
|
const ViewData* mostSuitableView = nullptr;
|
|
|
|
|
for (const ViewData* other : mUsedViews)
|
|
|
|
|
{
|
|
|
|
@ -157,11 +157,16 @@ ViewData *ViewDataMap::getViewData(osg::Object *viewer, const osg::Vec3f& viewPo
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (mostSuitableView && mostSuitableView != vd)
|
|
|
|
|
if (mostSuitableView)
|
|
|
|
|
{
|
|
|
|
|
vd->copyFrom(*mostSuitableView);
|
|
|
|
|
return vd;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
vd->setViewPoint(viewPoint);
|
|
|
|
|
needsUpdate = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!vd->suitableToUse(activeGrid))
|
|
|
|
|
{
|
|
|
|
|