1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-17 01:10:10 +00:00

Don't sort scene light list by camera distance if the limit isn't reached and PP doesn't need it

Also don't clip it to the single UBO scene light limit if the lighting method isn't actually single UBO
This commit is contained in:
Alexei Kotov 2024-05-26 00:00:24 +03:00
parent 916706c6c1
commit c92d016e43

View File

@ -1161,8 +1161,10 @@ namespace SceneUtil
}
const bool fillPPLights = mPPLightBuffer && it->first->getName() == Constants::SceneCamera;
const bool sceneLimitReached = getLightingMethod() == LightingMethod::SingleUBO
&& it->second.size() > static_cast<size_t>(getMaxLightsInScene() - 1);
if (fillPPLights || getLightingMethod() == LightingMethod::SingleUBO)
if (fillPPLights || sceneLimitReached)
{
auto sorter = [](const LightSourceViewBound& left, const LightSourceViewBound& right) {
return left.mViewBound.center().length2() - left.mViewBound.radius2()
@ -1183,7 +1185,7 @@ namespace SceneUtil
}
}
if (it->second.size() > static_cast<size_t>(getMaxLightsInScene() - 1))
if (sceneLimitReached)
it->second.resize(getMaxLightsInScene() - 1);
}
}