Lighting Performance Improvement (#13436)

This commit is contained in:
Fox McCloud
2020-05-20 00:21:16 -06:00
committed by GitHub
parent 2f5e4947bf
commit 10a7b897a6
4 changed files with 31 additions and 44 deletions
+7 -16
View File
@@ -43,12 +43,10 @@
light_range = source_atom.light_range
light_color = source_atom.light_color
parse_light_color()
PARSE_LIGHT_COLOR(src)
update()
return ..()
/datum/light_source/Destroy(force)
remove_lum()
if(source_atom)
@@ -94,17 +92,6 @@
/datum/light_source/proc/vis_update()
EFFECT_UPDATE(LIGHTING_VIS_UPDATE)
// Decompile the hexadecimal colour into lumcounts of each perspective.
/datum/light_source/proc/parse_light_color()
if(light_color)
lum_r = GetRedPart (light_color) / 255
lum_g = GetGreenPart (light_color) / 255
lum_b = GetBluePart (light_color) / 255
else
lum_r = 1
lum_g = 1
lum_b = 1
// Macro that applies light to a new corner.
// It is a macro in the interest of speed, yet not having to copy paste it.
// If you're wondering what's with the backslashes, the backslashes cause BYOND to not automatically end the line.
@@ -212,7 +199,7 @@
if(source_atom.light_color != light_color)
light_color = source_atom.light_color
parse_light_color()
PARSE_LIGHT_COLOR(src)
update = TRUE
else if(applied_lum_r != lum_r || applied_lum_g != lum_g || applied_lum_b != lum_b)
@@ -233,7 +220,11 @@
var/oldlum = source_turf.luminosity
source_turf.luminosity = CEILING(light_range, 1)
for(T in view(CEILING(light_range, 1), source_turf))
for (thing in T.get_corners(source_turf))
if((!IS_DYNAMIC_LIGHTING(T) && !T.light_sources) || T.has_opaque_atom)
continue
if(!T.lighting_corners_initialised)
T.generate_missing_corners()
for(thing in T.corners)
C = thing
corners[C] = 0
turfs += T
-11
View File
@@ -110,16 +110,6 @@
else
lighting_clear_overlay()
/turf/proc/get_corners()
if(!IS_DYNAMIC_LIGHTING(src) && !light_sources)
return null
if(!lighting_corners_initialised)
generate_missing_corners()
if(has_opaque_atom)
return null // Since this proc gets used in a for loop, null won't be looped though.
return corners
/turf/proc/generate_missing_corners()
if(!IS_DYNAMIC_LIGHTING(src) && !light_sources)
return
@@ -132,4 +122,3 @@
continue
corners[i] = new/datum/lighting_corner(src, GLOB.LIGHTING_CORNER_DIAGONAL[i])