Skip to content

Commit

Permalink
fixes bloom
Browse files Browse the repository at this point in the history
  • Loading branch information
dwasint committed Jul 2, 2024
1 parent bfca3b1 commit 881c3ea
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions code/modules/lighting/lighting_corner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@
lum_g += delta_g
lum_b += delta_b

add_r = clamp((lum_r - 1.35) * 0.4, 0, 0.3)
add_g = clamp((lum_g - 1.35) * 0.4, 0, 0.3)
add_b = clamp((lum_b - 1.35) * 0.4, 0, 0.3)
// Cull additive overlays that would be below 0.09 alpha in any color.
applying_additive = max(add_r, add_g, add_b) > 0.09
// Cull additive overlays whose color alpha sum is lower than 0.09
//applying_additive = (add_r + add_g + add_b) > 0.09

if (!needs_update)
needs_update = TRUE
SSlighting.corners_queue += src
Expand All @@ -129,6 +121,10 @@
var/old_g = cache_g
var/old_b = cache_b

var/old_add_r = add_r
var/old_add_g = add_g
var/old_add_b = add_b

if (largest_color_luminosity > 1)
. = 1 / largest_color_luminosity

Expand All @@ -145,12 +141,23 @@
cache_b = round(lum_b * ., LIGHTING_ROUND_VALUE)
#endif

add_r = clamp((lum_r - 1.35) * 0.3, 0, 0.22)
add_g = clamp((lum_g - 1.35) * 0.3, 0, 0.22)
add_b = clamp((lum_b - 1.35) * 0.3, 0, 0.22)

// Client-shredding, does not cull any additive overlays.
//applying_additive = add_r || add_g || add_b
// Cull additive overlays that would be below 0.03 alpha in any color.
applying_additive = max(add_r, add_g, add_b) > 0.03
// Cull additive overlays whose color alpha sum is lower than 0.03
//applying_additive = (add_r + add_g + add_b) > 0.03

src.largest_color_luminosity = round(largest_color_luminosity, LIGHTING_ROUND_VALUE)
#ifdef VISUALIZE_LIGHT_UPDATES
if(!SSlighting.allow_duped_corners && old_r == cache_r && old_g == cache_g && old_b == cache_b)
if(!SSlighting.allow_duped_corners && old_r == cache_r && old_g == cache_g && old_b == cache_b && old_add_r == add_r && old_add_b == add_b && old_add_g == add_g)
return
#else
if(old_r == cache_r && old_g == cache_g && old_b == cache_b)
if(old_r == cache_r && old_g == cache_g && old_b == cache_b && old_add_r == add_r && old_add_b == add_b && old_add_g == add_g)
return
#endif

Expand Down

0 comments on commit 881c3ea

Please sign in to comment.