mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Optimizes lighting overlays for slow clients.
Ports https://github.com/tgstation/tgstation/pull/25778 and https://github.com/tgstation/tgstation/pull/25861 * Instead of using color matrix for all overlays, fully dark and fully light use static black and transparant icon states without color matrix. * Also implements LIGHTING_ROUND_VALUE so that lighting values actually will reach 0 or 1.
This commit is contained in:
@@ -98,20 +98,28 @@
|
||||
lighting_update_corners += src
|
||||
|
||||
/datum/lighting_corner/proc/update_overlays()
|
||||
|
||||
// Cache these values a head of time so 4 individual lighting overlays don't all calculate them individually.
|
||||
var/lum_r = src.lum_r
|
||||
var/lum_g = src.lum_g
|
||||
var/lum_b = src.lum_b
|
||||
var/mx = max(lum_r, lum_g, lum_b) // Scale it so 1 is the strongest lum, if it is above 1.
|
||||
. = 1 // factor
|
||||
if (mx > 1)
|
||||
. = 1 / mx
|
||||
|
||||
#if LIGHTING_SOFT_THRESHOLD != 0
|
||||
else if (mx < LIGHTING_SOFT_THRESHOLD)
|
||||
. = 0 // 0 means soft lighting.
|
||||
|
||||
cache_r = lum_r * . || LIGHTING_SOFT_THRESHOLD
|
||||
cache_g = lum_g * . || LIGHTING_SOFT_THRESHOLD
|
||||
cache_b = lum_b * . || LIGHTING_SOFT_THRESHOLD
|
||||
cache_mx = mx
|
||||
cache_r = round(lum_r * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
|
||||
cache_g = round(lum_g * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
|
||||
cache_b = round(lum_b * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
|
||||
#else
|
||||
cache_r = round(lum_r * ., LIGHTING_ROUND_VALUE)
|
||||
cache_g = round(lum_g * ., LIGHTING_ROUND_VALUE)
|
||||
cache_b = round(lum_b * ., LIGHTING_ROUND_VALUE)
|
||||
#endif
|
||||
cache_mx = round(mx, LIGHTING_ROUND_VALUE)
|
||||
|
||||
for (var/TT in masters)
|
||||
var/turf/T = TT
|
||||
|
||||
Reference in New Issue
Block a user