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
esm4-texture
Alexei Kotov 7 months ago
parent 916706c6c1
commit c92d016e43

@ -1161,8 +1161,10 @@ namespace SceneUtil
} }
const bool fillPPLights = mPPLightBuffer && it->first->getName() == Constants::SceneCamera; 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) { auto sorter = [](const LightSourceViewBound& left, const LightSourceViewBound& right) {
return left.mViewBound.center().length2() - left.mViewBound.radius2() 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); it->second.resize(getMaxLightsInScene() - 1);
} }
} }

Loading…
Cancel
Save