diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-06-28 17:10:17 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-06-28 17:10:17 +1000 |
commit | 54ac208dd5a54c827567a3a86e152680ae7663ea (patch) | |
tree | 86218292795659a558f5ae65a712f1e6ed0e33ea /source/base/StarCellularLightArray.cpp | |
parent | bb5387fbdb90ec5e3b387ed73718b281b207252b (diff) |
lighting: disable the new additive point light behavior when new lighting is off
Diffstat (limited to 'source/base/StarCellularLightArray.cpp')
-rw-r--r-- | source/base/StarCellularLightArray.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/source/base/StarCellularLightArray.cpp b/source/base/StarCellularLightArray.cpp index 49e0917..c20cd5c 100644 --- a/source/base/StarCellularLightArray.cpp +++ b/source/base/StarCellularLightArray.cpp @@ -64,12 +64,12 @@ void CellularLightArray<ScalarLightTraits>::calculatePointLighting(size_t xmin, attenuation += min(blockAttenuation, circularizedPerBlockObstacleAttenuation) * m_pointObstacleBoost; if (attenuation < 1.0f) { - auto newLight = ScalarLightTraits::subtract(light.value, attenuation); - if (ScalarLightTraits::maxIntensity(newLight) > 0.0001f) { - if (light.asSpread) - setLight(x, y, lvalue + newLight * 0.15f); - else - setLight(x, y, lvalue + newLight); + if (m_pointAdditive) { + auto newLight = ScalarLightTraits::subtract(light.value, attenuation); + if (ScalarLightTraits::maxIntensity(newLight) > 0.0001f) + setLight(x, y, lvalue + (light.asSpread ? newLight * 0.15f : newLight)); + } else { + setLight(x, y, ScalarLightTraits::max(ScalarLightTraits::subtract(light.value, attenuation), lvalue)); } } } @@ -137,12 +137,12 @@ void CellularLightArray<ColoredLightTraits>::calculatePointLighting(size_t xmin, attenuation += min(blockAttenuation, circularizedPerBlockObstacleAttenuation) * m_pointObstacleBoost; if (attenuation < 1.0f) { - auto newLight = ColoredLightTraits::subtract(light.value, attenuation); - if (ColoredLightTraits::maxIntensity(newLight) > 0.0001f) { - if (light.asSpread) - setLight(x, y, lvalue + newLight * 0.15f); - else - setLight(x, y, lvalue + newLight); + if (m_pointAdditive) { + auto newLight = ColoredLightTraits::subtract(light.value, attenuation); + if (ColoredLightTraits::maxIntensity(newLight) > 0.0001f) + setLight(x, y, lvalue + (light.asSpread ? newLight * 0.15f : newLight)); + } else { + setLight(x, y, ColoredLightTraits::max(ColoredLightTraits::subtract(light.value, attenuation), lvalue)); } } } |