adds ambient occlusion as a client preference (#37406)

ambient occlusion is a shading technique that simulates how light behaves in the real world, where areas that aren't directly exposed to light tend to receive less lighting. In 3d rendered scenes with ambient occlusion present, this can easily be seen in corners and other crevices in geometry, and can also be visible when two objects are close to one another.

cl deathride58
add: Added ambient occlusion. You can toggle this on or off in the game preferences menu.
/cl
This commit is contained in:
deathride58
2018-05-07 22:06:44 +00:00
committed by oranges
parent 928d794794
commit cdf36c2c6f
14 changed files with 48 additions and 9 deletions
+1
View File
@@ -6,6 +6,7 @@
#define PLANE_SPACE -95
#define PLANE_SPACE_PARALLAX -90
#define FLOOR_PLANE -2
#define GAME_PLANE -1
#define BLACKNESS_PLANE 0 //To keep from conflicts with SEE_BLACKNESS internals
#define SPACE_LAYER 1.8
+3
View File
@@ -439,3 +439,6 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE
#define NO_INIT_PARAMETER "no-init"
#define EGG_LAYING_MESSAGES list("lays an egg.","squats down and croons.","begins making a huge racket.","begins clucking raucously.")
//Filters
#define AMBIENT_OCCLUSION filter(type="drop_shadow", x=0, y=-2, size=4, border=4, color="#04080FAA")
+10
View File
@@ -16,12 +16,22 @@
//Trust me, you need one. Period. If you don't think you do, you're doing something extremely wrong.
/obj/screen/plane_master/proc/backdrop(mob/mymob)
/obj/screen/plane_master/floor
name = "floor plane master"
plane = FLOOR_PLANE
appearance_flags = PLANE_MASTER
blend_mode = BLEND_OVERLAY
/obj/screen/plane_master/game_world
name = "game world plane master"
plane = GAME_PLANE
appearance_flags = PLANE_MASTER //should use client color
blend_mode = BLEND_OVERLAY
/obj/screen/plane_master/game_world/backdrop(mob/mymob)
if(istype(mymob) && mymob.client && mymob.client.prefs && mymob.client.prefs.ambientocclusion)
filters += AMBIENT_OCCLUSION
/obj/screen/plane_master/lighting
name = "lighting plane master"
plane = LIGHTING_PLANE
+2 -1
View File
@@ -7,6 +7,7 @@
icon = 'icons/turf/areas.dmi'
icon_state = "unknown"
layer = AREA_LAYER
plane = BLACKNESS_PLANE //Keeping this on the default plane, GAME_PLANE, will make area overlays fail to render on FLOOR_PLANE.
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
invisibility = INVISIBILITY_LIGHTING
@@ -518,4 +519,4 @@ GLOBAL_LIST_EMPTY(teleportlocs)
// A hook so areas can modify the incoming args
/area/proc/PlaceOnTopReact(list/new_baseturfs, turf/fake_turf_type, flags)
return flags
return flags
+1
View File
@@ -4,6 +4,7 @@
icon = 'icons/obj/device.dmi'
icon_state = "ai-slipper0"
layer = PROJECTILE_HIT_THRESHHOLD_LAYER
plane = FLOOR_PLANE
anchored = TRUE
max_integrity = 200
armor = list("melee" = 50, "bullet" = 20, "laser" = 20, "energy" = 20, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 30)
+4 -3
View File
@@ -32,6 +32,7 @@ Possible to do for anyone motivated enough:
desc = "It's a floor-mounted device for projecting holographic images."
icon_state = "holopad0"
layer = LOW_OBJ_LAYER
plane = FLOOR_PLANE
flags_1 = HEAR_1
anchored = TRUE
use_power = IDLE_POWER_USE
@@ -66,7 +67,7 @@ Possible to do for anyone motivated enough:
flags_1 = NODECONSTRUCT_1
on_network = FALSE
var/proximity_range = 1
/obj/machinery/holopad/tutorial/Initialize(mapload)
. = ..()
if(proximity_range)
@@ -86,7 +87,7 @@ Possible to do for anyone motivated enough:
replay_stop()
else if(disk && disk.record)
replay_start()
/obj/machinery/holopad/tutorial/HasProximity(atom/movable/AM)
if (!isliving(AM))
return
@@ -487,7 +488,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
if(QDELETED(user) || user.incapacitated() || !user.client)
return FALSE
return TRUE
//Can we display holos there
//Area check instead of line of sight check because this is a called a lot if AI wants to move around.
/obj/machinery/holopad/proc/validate_location(turf/T,check_los = FALSE)
+2 -1
View File
@@ -3,6 +3,7 @@
desc = "It's useful for igniting plasma."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "igniter0"
plane = FLOOR_PLANE
var/id = null
var/on = FALSE
anchored = TRUE
@@ -12,7 +13,7 @@
max_integrity = 300
armor = list("melee" = 50, "bullet" = 30, "laser" = 70, "energy" = 50, "bomb" = 20, "bio" = 0, "rad" = 0, "fire" = 100, "acid" = 70)
resistance_flags = FIRE_PROOF
/obj/machinery/igniter/on
on = TRUE
icon_state = "igniter1"
@@ -1,5 +1,6 @@
/obj/effect/decal
name = "decal"
plane = FLOOR_PLANE
anchored = TRUE
resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF
var/turf_loc_check = TRUE
+1
View File
@@ -8,6 +8,7 @@
armor = list("melee" = 50, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 50)
max_integrity = 50
layer = LATTICE_LAYER //under pipes
plane = FLOOR_PLANE
var/number_of_rods = 1
canSmoothWith = list(/obj/structure/lattice,
/turf/open/floor,
+1
View File
@@ -1,4 +1,5 @@
/turf/open
plane = FLOOR_PLANE
var/slowdown = 0 //negative for faster, positive for slower
var/mutable_appearance/wet_overlay
@@ -34,8 +34,10 @@ Iconnery
var/turf/T = loc
if(level == 2 || !T.intact)
showpipe = TRUE
plane = GAME_PLANE
else
showpipe = FALSE
plane = FLOOR_PLANE
if(!showpipe)
return //no need to update the pipes if they aren't showing
+13
View File
@@ -113,6 +113,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/parallax
var/ambientocclusion = TRUE
var/uplink_spawn_loc = UPLINK_PDA
var/list/exp = list()
@@ -507,6 +509,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
else
dat += "High"
dat += "</a><br>"
dat += "<b>Ambient Occlusion:</b> <a href='?_src_=prefs;preference=ambientocclusion'>[ambientocclusion ? "Enabled" : "Disabled"]</a><br>"
if (CONFIG_GET(flag/maprotation))
var/p_map = preferred_map
if (!p_map)
@@ -1487,6 +1492,14 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if (parent && parent.mob && parent.mob.hud_used)
parent.mob.hud_used.update_parallax_pref(parent.mob)
if("ambientocclusion")
ambientocclusion = !ambientocclusion
if(parent && parent.screen && parent.screen.len)
var/obj/screen/plane_master/game_world/PM = locate(/obj/screen/plane_master/game_world) in parent.screen
PM.filters -= AMBIENT_OCCLUSION
if(ambientocclusion)
PM.filters += AMBIENT_OCCLUSION
if("save")
save_preferences()
save_character()
@@ -97,6 +97,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["uses_glasses_colour"]>> uses_glasses_colour
S["clientfps"] >> clientfps
S["parallax"] >> parallax
S["ambientocclusion"] >> ambientocclusion
S["menuoptions"] >> menuoptions
S["enable_tips"] >> enable_tips
S["tip_delay"] >> tip_delay
@@ -120,6 +121,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
toggles = sanitize_integer(toggles, 0, 65535, initial(toggles))
clientfps = sanitize_integer(clientfps, 0, 1000, 0)
parallax = sanitize_integer(parallax, PARALLAX_INSANE, PARALLAX_DISABLE, null)
ambientocclusion = sanitize_integer(ambientocclusion, 0, 1, initial(ambientocclusion))
ghost_form = sanitize_inlist(ghost_form, GLOB.ghost_forms, initial(ghost_form))
ghost_orbit = sanitize_inlist(ghost_orbit, GLOB.ghost_orbits, initial(ghost_orbit))
ghost_accs = sanitize_inlist(ghost_accs, GLOB.ghost_accs_options, GHOST_ACCS_DEFAULT_OPTION)
@@ -165,6 +167,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["uses_glasses_colour"], uses_glasses_colour)
WRITE_FILE(S["clientfps"], clientfps)
WRITE_FILE(S["parallax"], parallax)
WRITE_FILE(S["ambientocclusion"], ambientocclusion)
WRITE_FILE(S["menuoptions"], menuoptions)
WRITE_FILE(S["enable_tips"], enable_tips)
WRITE_FILE(S["tip_delay"], tip_delay)
@@ -728,7 +728,7 @@
/datum/reagent/toxin/rotatium/on_mob_life(mob/living/M)
if(M.hud_used)
if(current_cycle >= 20 && current_cycle%20 == 0)
var/list/screens = list(M.hud_used.plane_masters["[GAME_PLANE]"], M.hud_used.plane_masters["[LIGHTING_PLANE]"])
var/list/screens = list(M.hud_used.plane_masters["[FLOOR_PLANE]"], M.hud_used.plane_masters["[GAME_PLANE]"], M.hud_used.plane_masters["[LIGHTING_PLANE]"])
var/rotation = min(round(current_cycle/20), 89) // By this point the player is probably puking and quitting anyway
for(var/whole_screen in screens)
animate(whole_screen, transform = matrix(rotation, MATRIX_ROTATE), time = 5, easing = QUAD_EASING, loop = -1)
@@ -737,7 +737,7 @@
/datum/reagent/toxin/rotatium/on_mob_delete(mob/living/M)
if(M && M.hud_used)
var/list/screens = list(M.hud_used.plane_masters["[GAME_PLANE]"], M.hud_used.plane_masters["[LIGHTING_PLANE]"])
var/list/screens = list(M.hud_used.plane_masters["[FLOOR_PLANE]"], M.hud_used.plane_masters["[GAME_PLANE]"], M.hud_used.plane_masters["[LIGHTING_PLANE]"])
for(var/whole_screen in screens)
animate(whole_screen, transform = matrix(), time = 5, easing = QUAD_EASING)
..()
@@ -755,7 +755,7 @@
/datum/reagent/toxin/skewium/on_mob_life(mob/living/M)
if(M.hud_used)
if(current_cycle >= 5 && current_cycle % 3 == 0)
var/list/screens = list(M.hud_used.plane_masters["[GAME_PLANE]"], M.hud_used.plane_masters["[LIGHTING_PLANE]"])
var/list/screens = list(M.hud_used.plane_masters["[FLOOR_PLANE]"], M.hud_used.plane_masters["[GAME_PLANE]"], M.hud_used.plane_masters["[LIGHTING_PLANE]"])
var/matrix/skew = matrix()
var/intensity = 8
skew.set_skew(rand(-intensity,intensity), rand(-intensity,intensity))
@@ -772,7 +772,7 @@
/datum/reagent/toxin/skewium/on_mob_delete(mob/living/M)
if(M && M.hud_used)
var/list/screens = list(M.hud_used.plane_masters["[GAME_PLANE]"], M.hud_used.plane_masters["[LIGHTING_PLANE]"])
var/list/screens = list(M.hud_used.plane_masters["[FLOOR_PLANE]"], M.hud_used.plane_masters["[GAME_PLANE]"], M.hud_used.plane_masters["[LIGHTING_PLANE]"])
for(var/whole_screen in screens)
animate(whole_screen, transform = matrix(), time = 5, easing = QUAD_EASING)
..()