1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

Merge branch 'rm_redundant_code' into 'master'

Avoid unnecessary computation

See merge request OpenMW/openmw!1623
This commit is contained in:
Cody Glassman 2022-02-02 23:50:24 +00:00
commit 002d0bf694

View File

@ -656,11 +656,10 @@ namespace MWRender
if (relativeLuminance < mMinimumAmbientLuminance)
{
// brighten ambient so it reaches the minimum threshold but no more, we want to mess with content data as least we can
float targetBrightnessIncreaseFactor = mMinimumAmbientLuminance / relativeLuminance;
if (ambient.r() == 0.f && ambient.g() == 0.f && ambient.b() == 0.f)
ambient = osg::Vec4(mMinimumAmbientLuminance, mMinimumAmbientLuminance, mMinimumAmbientLuminance, ambient.a());
else
ambient *= targetBrightnessIncreaseFactor;
ambient *= mMinimumAmbientLuminance / relativeLuminance;
}
}