mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 03:02:54 +00:00
client optimizations for lighting overlays
Removes lighting transitions- they don't work with the new system. Greyscale overlays now use BLEND_OVERLAY instead of BLEND_MULTIPLY for better client performance. Light overlays in total darkness are now made invisible. Signed-off-by: Mloc <colmohici@gmail.com>
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
#define LIGHTING_FALLOFF 1 // type of falloff to use for lighting; 1 for circular, 2 for square
|
#define LIGHTING_FALLOFF 1 // type of falloff to use for lighting; 1 for circular, 2 for square
|
||||||
#define LIGHTING_LAMBERTIAN 1 // use lambertian shading for light sources
|
#define LIGHTING_LAMBERTIAN 1 // use lambertian shading for light sources
|
||||||
#define LIGHTING_HEIGHT 1 // height off the ground of light sources on the pseudo-z-axis, you should probably leave this alone
|
#define LIGHTING_HEIGHT 1 // height off the ground of light sources on the pseudo-z-axis, you should probably leave this alone
|
||||||
#define LIGHTING_TRANSITIONS 1 // smooth, animated transitions, similar to /tg/station
|
|
||||||
#define LIGHTING_ROUND_VALUE (1 / 128) //Value used to round lumcounts, values smaller than 1/255 don't matter (if they do, thanks sinking points), greater values will make lighting less precise, but in turn increase performance, VERY SLIGHTLY.
|
#define LIGHTING_ROUND_VALUE (1 / 128) //Value used to round lumcounts, values smaller than 1/255 don't matter (if they do, thanks sinking points), greater values will make lighting less precise, but in turn increase performance, VERY SLIGHTLY.
|
||||||
|
|
||||||
#define LIGHTING_LAYER 10 // drawing layer for lighting overlays
|
#define LIGHTING_LAYER 10 // drawing layer for lighting overlays
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
icon_state = "light1"
|
icon_state = "light1"
|
||||||
layer = LIGHTING_LAYER
|
layer = LIGHTING_LAYER
|
||||||
invisibility = INVISIBILITY_LIGHTING
|
invisibility = INVISIBILITY_LIGHTING
|
||||||
blend_mode = BLEND_MULTIPLY
|
|
||||||
color = "#000000"
|
color = "#000000"
|
||||||
|
|
||||||
var/lum_r
|
var/lum_r
|
||||||
@@ -53,32 +52,31 @@
|
|||||||
lighting_update_overlays += src
|
lighting_update_overlays += src
|
||||||
|
|
||||||
/atom/movable/lighting_overlay/proc/update_overlay()
|
/atom/movable/lighting_overlay/proc/update_overlay()
|
||||||
|
var/turf/T = loc
|
||||||
|
|
||||||
|
if(istype(T)) //Incase we're not on a turf, pool ourselves, something happened.
|
||||||
|
if(lum_r == lum_g && lum_r == lum_b) //greyscale
|
||||||
|
blend_mode = BLEND_OVERLAY
|
||||||
|
if(lum_r <= 0)
|
||||||
|
T.luminosity = 0
|
||||||
|
color = "#000000"
|
||||||
|
alpha = 255
|
||||||
|
else
|
||||||
|
T.luminosity = 1
|
||||||
|
color = "#000000"
|
||||||
|
alpha = (1 - min(lum_r, 1)) * 255
|
||||||
|
else
|
||||||
|
alpha = 255
|
||||||
var/mx = max(lum_r, lum_g, lum_b)
|
var/mx = max(lum_r, lum_g, lum_b)
|
||||||
. = 1 // factor
|
. = 1 // factor
|
||||||
if(mx > 1)
|
if(mx > 1)
|
||||||
. = 1/mx
|
. = 1/mx
|
||||||
#if LIGHTING_TRANSITIONS == 1
|
blend_mode = BLEND_MULTIPLY
|
||||||
animate(src,
|
|
||||||
color = rgb(lum_r * 255 * ., lum_g * 255 * ., lum_b * 255 * .),
|
|
||||||
LIGHTING_INTERVAL - 1
|
|
||||||
)
|
|
||||||
#else
|
|
||||||
color = rgb(lum_r * 255 * ., lum_g * 255 * ., lum_b * 255 * .)
|
color = rgb(lum_r * 255 * ., lum_g * 255 * ., lum_b * 255 * .)
|
||||||
#endif
|
|
||||||
|
|
||||||
var/turf/T = loc
|
|
||||||
|
|
||||||
if(istype(T)) //Incase we're not on a turf, pool ourselves, something happened.
|
|
||||||
if(color != "#000000")
|
if(color != "#000000")
|
||||||
T.luminosity = 1
|
T.luminosity = 1
|
||||||
else //No light, set the turf's luminosity to 0 to remove it from view()
|
else //No light, set the turf's luminosity to 0 to remove it from view()
|
||||||
#if LIGHTING_TRANSITIONS == 1
|
|
||||||
spawn(LIGHTING_INTERVAL - 1)
|
|
||||||
T.luminosity = 0
|
T.luminosity = 0
|
||||||
#else
|
|
||||||
T.luminosity = 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
else
|
else
|
||||||
warning("A lighting overlay realised its loc was NOT a turf (actual loc: [loc][loc ? ", " + loc.type : ""]) in update_overlay() and got pooled!")
|
warning("A lighting overlay realised its loc was NOT a turf (actual loc: [loc][loc ? ", " + loc.type : ""]) in update_overlay() and got pooled!")
|
||||||
qdel(src)
|
qdel(src)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
#undef LIGHTING_FALLOFF
|
#undef LIGHTING_FALLOFF
|
||||||
#undef LIGHTING_LAMBERTIAN
|
#undef LIGHTING_LAMBERTIAN
|
||||||
#undef LIGHTING_HEIGHT
|
#undef LIGHTING_HEIGHT
|
||||||
#undef LIGHTING_TRANSITIONS
|
|
||||||
|
|
||||||
#undef LIGHTING_RESOLUTION
|
#undef LIGHTING_RESOLUTION
|
||||||
#undef LIGHTING_LAYER
|
#undef LIGHTING_LAYER
|
||||||
|
|||||||
Reference in New Issue
Block a user