From 66c9469a804d772d56f60e0329b46d48d69432e4 Mon Sep 17 00:00:00 2001 From: bzzt lost a hitlab login Date: Tue, 12 May 2020 13:37:00 +0000 Subject: [PATCH] fix Signed-off-by: Bret Curtis --- apps/openmw/mwrender/objectpaging.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/apps/openmw/mwrender/objectpaging.cpp b/apps/openmw/mwrender/objectpaging.cpp index b138a64126..8cff46fa89 100644 --- a/apps/openmw/mwrender/objectpaging.cpp +++ b/apps/openmw/mwrender/objectpaging.cpp @@ -444,15 +444,12 @@ namespace MWRender if (size < 1.f) { osg::Vec3f cellPos = pos / ESM::Land::REAL_SIZE; - cellPos.x() = std::max(cellPos.x(), std::floor(minBound.x())); - cellPos.x() = std::min(cellPos.x(), std::ceil(maxBound.x())); - cellPos.y() = std::max(cellPos.y(), std::floor(minBound.y())); - cellPos.y() = std::min(cellPos.y(), std::ceil(maxBound.y())); - if (cellPos.x() < minBound.x() || cellPos.x() > maxBound.x() || cellPos.y() < minBound.y() || cellPos.y() > maxBound.y()) + if ((minBound.x() > std::floor(minBound.x()) && cellPos.x() < minBound.x()) || (minBound.y() > std::floor(minBound.y()) && cellPos.y() < minBound.y())) + continue; + if ((maxBound.x() < std::ceil(maxBound.x()) && cellPos.x() >= maxBound.x()) || (minBound.y() < std::ceil(maxBound.y()) && cellPos.y() >= maxBound.y())) continue; } - float d = (viewPoint - pos).length(); if (!activeGrid) { @@ -619,7 +616,7 @@ namespace MWRender if (mergeGroup->getNumChildren()) { SceneUtil::Optimizer optimizer; - if ((relativeViewPoint - mergeGroup->getBound().center()).length2() > mergeGroup->getBound().radius2()) + if ((relativeViewPoint - mergeGroup->getBound().center()).length() > mergeGroup->getBound().radius()*2) { optimizer.setViewPoint(relativeViewPoint); optimizer.setMergeAlphaBlending(true); @@ -630,17 +627,16 @@ namespace MWRender group->addChild(mergeGroup); - if (compile) - { - stateToCompile._mode = osgUtil::GLObjectsVisitor::COMPILE_DISPLAY_LISTS; - mergeGroup->accept(stateToCompile); - } - if (mDebugBatches) { DebugVisitor dv; mergeGroup->accept(dv); } + if (compile) + { + stateToCompile._mode = osgUtil::GLObjectsVisitor::COMPILE_DISPLAY_LISTS; + mergeGroup->accept(stateToCompile); + } } auto ico = mSceneManager->getIncrementalCompileOperation();