mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-23 13:57:03 +01:00
94d92803b4
Depends on #21458. Ports https://github.com/cmss13-devs/cmss13/pull/4229, with the original authors as: - https://github.com/tgstation/TerraGov-Marine-Corps/pull/1964 for the lighting controller (A-lexa) - https://github.com/tgstation/TerraGov-Marine-Corps/pull/4747 and https://github.com/tgstation/TerraGov-Marine-Corps/pull/7263 for the lighting (TiviPlus) - https://github.com/tgstation/tgstation/pull/54520 for the dir lighting component - https://github.com/tgstation/tgstation/pull/75018 for the out of bounds fix in lighting - https://github.com/tgstation/TerraGov-Marine-Corps/pull/6678 for the emissives (TiviPlus) The main driving reason behind this is that current lighting consumes way too much processing power, especially for things like odysseys/away sites where a billion light sources are processing/moving at once and the game slows down to a crawl. Hopefully this improves the situation by a good margin, but we will need some testmerging to confirm that. <img width="1349" height="1349" alt="image" src="https://github.com/user-attachments/assets/1059ba2b-c0c5-495a-9c76-2d75d0c42bf2" /> <img width="1349" height="1349" alt="image" src="https://github.com/user-attachments/assets/9704b0f6-4cf6-4dfd-a6cb-5702ad07d677" /> - [x] Resolve todos - [x] Look into open space fuckery (border objects) --------- Co-authored-by: Matt Atlas <liermattia@gmail.com> Co-authored-by: JohnWildkins <john.wildkins@gmail.com>
206 lines
7.4 KiB
Plaintext
206 lines
7.4 KiB
Plaintext
/atom/movable/screen/plane_master
|
|
screen_loc = "CENTER"
|
|
icon_state = "blank"
|
|
appearance_flags = PLANE_MASTER|NO_CLIENT_COLOR
|
|
blend_mode = BLEND_OVERLAY
|
|
plane = LOWEST_EVER_PLANE
|
|
var/show_alpha = 255
|
|
var/hide_alpha = 0
|
|
|
|
//--rendering relay vars--
|
|
///integer: what plane we will relay this planes render to
|
|
var/render_relay_plane = RENDER_PLANE_GAME
|
|
///bool: Whether this plane should get a render target automatically generated
|
|
var/generate_render_target = TRUE
|
|
///integer: blend mode to apply to the render relay in case you dont want to use the plane_masters blend_mode
|
|
var/blend_mode_override
|
|
///reference: current relay this plane is utilizing to render
|
|
var/obj/render_plane_relay/relay
|
|
|
|
/atom/movable/screen/plane_master/proc/Show(override)
|
|
alpha = override || show_alpha
|
|
|
|
/atom/movable/screen/plane_master/proc/Hide(override)
|
|
alpha = override || hide_alpha
|
|
|
|
//Why do plane masters need a backdrop sometimes? Read https://secure.byond.com/forum/?post=2141928
|
|
//Trust me, you need one. Period. If you don't think you do, you're doing something extremely wrong.
|
|
/atom/movable/screen/plane_master/proc/backdrop(mob/mymob)
|
|
SHOULD_CALL_PARENT(TRUE)
|
|
if(!isnull(render_relay_plane))
|
|
relay_render_to_plane(mymob, render_relay_plane)
|
|
|
|
///Contains most things in the game world
|
|
/atom/movable/screen/plane_master/game_world
|
|
name = "game world plane master"
|
|
plane = GAME_PLANE
|
|
appearance_flags = PLANE_MASTER
|
|
blend_mode = BLEND_OVERLAY
|
|
|
|
/atom/movable/screen/plane_master/game_world/backdrop(mob/mymob)
|
|
. = ..()
|
|
remove_filter("AO")
|
|
add_filter("AO", 1, drop_shadow_filter(x = 0, y = -2, size = 4, color = "#04080FAA"))
|
|
|
|
/atom/movable/screen/plane_master/game_world_above
|
|
name = "above game world plane master"
|
|
plane = ABOVE_GAME_PLANE
|
|
|
|
/atom/movable/screen/plane_master/ghost
|
|
name = "ghost plane master"
|
|
plane = GHOST_PLANE
|
|
render_relay_plane = RENDER_PLANE_NON_GAME
|
|
|
|
/// Plane master handling display of building roofs. They're meant to become invisible when inside a building.
|
|
/atom/movable/screen/plane_master/roof
|
|
name = "roof plane master"
|
|
plane = ROOF_PLANE
|
|
appearance_flags = PLANE_MASTER
|
|
blend_mode = BLEND_OVERLAY
|
|
|
|
/atom/movable/screen/plane_master/space
|
|
name = "space plane master"
|
|
plane = SPACE_PLANE
|
|
blend_mode = BLEND_OVERLAY
|
|
|
|
/// Plane master handling skyboxes.
|
|
/atom/movable/screen/plane_master/skybox
|
|
name = "skybox plane master"
|
|
plane = SKYBOX_PLANE
|
|
blend_mode = BLEND_MULTIPLY
|
|
appearance_flags = PLANE_MASTER
|
|
|
|
/**
|
|
* Plane master handling byond internal blackness
|
|
* vars are set as to replicate behavior when rendering to other planes
|
|
* do not touch this unless you know what you are doing
|
|
*/
|
|
/atom/movable/screen/plane_master/blackness
|
|
name = "darkness plane master"
|
|
plane = BLACKNESS_PLANE
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
blend_mode = BLEND_MULTIPLY
|
|
appearance_flags = PLANE_MASTER | NO_CLIENT_COLOR | PIXEL_SCALE
|
|
//byond internal end
|
|
|
|
/*!
|
|
* This system works by exploiting BYONDs color matrix filter to use layers to handle emissive blockers.
|
|
*
|
|
* Emissive overlays are pasted with an atom color that converts them to be entirely some specific color.
|
|
* Emissive blockers are pasted with an atom color that converts them to be entirely some different color.
|
|
* Emissive overlays and emissive blockers are put onto the same plane.
|
|
* The layers for the emissive overlays and emissive blockers cause them to mask eachother similar to normal BYOND objects.
|
|
* A color matrix filter is applied to the emissive plane to mask out anything that isn't whatever the emissive color is.
|
|
* This is then used to alpha mask the lighting plane.
|
|
*/
|
|
|
|
///Contains all lighting objects
|
|
/atom/movable/screen/plane_master/lighting
|
|
name = "lighting plane master"
|
|
plane = LIGHTING_PLANE
|
|
blend_mode_override = BLEND_MULTIPLY
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
|
|
/atom/movable/screen/plane_master/lighting/backdrop(mob/mymob)
|
|
. = ..()
|
|
mymob.overlay_fullscreen("lighting_backdrop", /atom/movable/screen/fullscreen/lighting_backdrop/backplane)
|
|
mymob.overlay_fullscreen("lighting_backdrop_lit_secondary", /atom/movable/screen/fullscreen/lighting_backdrop/lit_secondary)
|
|
|
|
/atom/movable/screen/plane_master/lighting/Initialize()
|
|
. = ..()
|
|
add_filter("emissives", 1, alpha_mask_filter(render_source = EMISSIVE_RENDER_TARGET, flags = MASK_INVERSE))
|
|
add_filter("object_lighting", 2, alpha_mask_filter(render_source = O_LIGHTING_VISUAL_RENDER_TARGET, flags = MASK_INVERSE))
|
|
/**
|
|
* Handles emissive overlays and emissive blockers.
|
|
*/
|
|
/atom/movable/screen/plane_master/emissive
|
|
name = "emissive plane master"
|
|
plane = EMISSIVE_PLANE
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
render_target = EMISSIVE_RENDER_TARGET
|
|
render_relay_plane = null
|
|
|
|
/atom/movable/screen/plane_master/emissive/Initialize()
|
|
. = ..()
|
|
add_filter("em_block_masking", 1, color_matrix_filter(GLOB.em_mask_matrix))
|
|
|
|
/atom/movable/screen/plane_master/above_lighting
|
|
name = "above lighting plane master"
|
|
plane = ABOVE_LIGHTING_PLANE
|
|
appearance_flags = PLANE_MASTER //should use client color
|
|
blend_mode = BLEND_OVERLAY
|
|
render_relay_plane = RENDER_PLANE_GAME
|
|
|
|
/atom/movable/screen/plane_master/runechat
|
|
name = "runechat plane master"
|
|
plane = RUNECHAT_PLANE
|
|
appearance_flags = PLANE_MASTER
|
|
blend_mode = BLEND_OVERLAY
|
|
render_relay_plane = RENDER_PLANE_NON_GAME
|
|
|
|
/atom/movable/screen/plane_master/runechat/backdrop(mob/mymob)
|
|
. = ..()
|
|
remove_filter("AO")
|
|
add_filter("AO", 1, drop_shadow_filter(x = 0, y = -2, size = 4, color = "#04080FAA"))
|
|
|
|
/atom/movable/screen/plane_master/o_light_visual
|
|
name = "overlight light visual plane master"
|
|
plane = O_LIGHTING_VISUAL_PLANE
|
|
render_target = O_LIGHTING_VISUAL_RENDER_TARGET
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
blend_mode = BLEND_MULTIPLY
|
|
blend_mode_override = BLEND_MULTIPLY
|
|
|
|
/atom/movable/screen/plane_master/nvg_plane
|
|
name = "NVG plane"
|
|
plane = NVG_PLANE
|
|
render_relay_plane = RENDER_PLANE_GAME
|
|
blend_mode_override = BLEND_MULTIPLY
|
|
|
|
/atom/movable/screen/plane_master/fullscreen
|
|
name = "fullscreen alert plane"
|
|
plane = FULLSCREEN_PLANE
|
|
render_relay_plane = RENDER_PLANE_NON_GAME
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
|
|
/atom/movable/screen/plane_master/hud
|
|
name = "HUD plane"
|
|
plane = HUD_PLANE
|
|
render_relay_plane = RENDER_PLANE_NON_GAME
|
|
|
|
/atom/movable/screen/plane_master/cinematic
|
|
name = "cinematic plane"
|
|
plane = CINEMATIC_PLANE
|
|
render_relay_plane = RENDER_PLANE_NON_GAME
|
|
|
|
/atom/movable/screen/plane_master/displacement
|
|
name = "displacement plane"
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
plane = DISPLACEMENT_PLATE_RENDER_LAYER
|
|
render_target = DISPLACEMENT_PLATE_RENDER_TARGET
|
|
render_relay_plane = null
|
|
|
|
/atom/movable/screen/plane_master/open_space
|
|
name = "open space plane"
|
|
plane = OPEN_SPACE_PLANE_END //aurora snowflake: our openspace system works bottom up, not top down like CM's
|
|
|
|
/atom/movable/screen/plane_master/open_space/Initialize(mapload, offset)
|
|
name = "open space plane [offset]"
|
|
plane -= offset
|
|
. = ..()
|
|
add_filter("multizblur", 1, gauss_blur_filter(0.5 + 0.25 * (offset + 1)))
|
|
|
|
/atom/movable/screen/plane_master/openspace_backdrop
|
|
name = "open space plane master"
|
|
plane = OPENSPACE_BACKDROP_PLANE
|
|
appearance_flags = PLANE_MASTER
|
|
blend_mode = BLEND_MULTIPLY
|
|
alpha = 255
|
|
|
|
/atom/movable/screen/plane_master/openspace_backdrop/Initialize()
|
|
. = ..()
|
|
filters = list()
|
|
filters += filter(type = "drop_shadow", color = "#04080FAA", size = -10)
|
|
filters += filter(type = "drop_shadow", color = "#04080FAA", size = -15)
|
|
filters += filter(type = "drop_shadow", color = "#04080FAA", size = -20)
|