diff --git a/code/__DEFINES/lighting.dm b/code/__DEFINES/lighting.dm index 98c4cdae3d3..ca56fab92ac 100644 --- a/code/__DEFINES/lighting.dm +++ b/code/__DEFINES/lighting.dm @@ -118,6 +118,11 @@ GLOBAL_LIST_INIT(em_block_color, EM_BLOCK_COLOR) /// A globally cached version of [EM_MASK_MATRIX] for quick access. GLOBAL_LIST_INIT(em_mask_matrix, EM_MASK_MATRIX) +/// Maximum selectable value for emissive bloom, minimum being 0 which just disables it outright +#define MAXIMUM_EMISSIVE_BLOOM_SIZE 5 +/// Default value for emissive bloom +#define DEFAULT_EMISSIVE_BLOOM_SIZE 2 + /// Parse the hexadecimal color into lumcounts of each perspective. #define PARSE_LIGHT_COLOR(source) \ do { \ diff --git a/code/_onclick/hud/rendering/render_plate.dm b/code/_onclick/hud/rendering/render_plate.dm index 701aa4732a6..4572b66e040 100644 --- a/code/_onclick/hud/rendering/render_plate.dm +++ b/code/_onclick/hud/rendering/render_plate.dm @@ -138,7 +138,12 @@ /atom/movable/screen/plane_master/rendering_plate/emissive_bloom/Initialize(mapload, datum/hud/hud_owner, datum/plane_master_group/home, offset) . = ..() add_filter("emissive_mask", 1, alpha_mask_filter(render_source = OFFSET_RENDER_TARGET(EMISSIVE_BLOOM_MASK_RENDER_TARGET, offset))) - add_filter("emissive_bloom", 2, bloom_filter(threshold = COLOR_BLACK, size = 2, offset = 1)) + var/bloom_scale = hud_owner?.mymob?.client?.prefs?.read_preference(/datum/preference/numeric/emissive_bloom) + if (isnull(bloom_scale)) + bloom_scale = DEFAULT_EMISSIVE_BLOOM_SIZE + // 0 disables the bloom + if (bloom_scale) + add_filter("emissive_bloom", 2, bloom_filter(threshold = COLOR_BLACK, size = bloom_scale, offset = ceil(bloom_scale / 2))) /atom/movable/screen/plane_master/rendering_plate/specular_mask name = "Specular mask plate" diff --git a/code/modules/client/preferences/emissive_bloom.dm b/code/modules/client/preferences/emissive_bloom.dm new file mode 100644 index 00000000000..517bf5d21a8 --- /dev/null +++ b/code/modules/client/preferences/emissive_bloom.dm @@ -0,0 +1,28 @@ +/// Size of the bloom filter applied to the emissive plane, mostly as a visual preference +/datum/preference/numeric/emissive_bloom + category = PREFERENCE_CATEGORY_GAME_PREFERENCES + savefile_key = "emissive_bloom" + savefile_identifier = PREFERENCE_PLAYER + + minimum = 0 + maximum = MAXIMUM_EMISSIVE_BLOOM_SIZE + +/datum/preference/numeric/emissive_bloom/create_default_value() + return DEFAULT_EMISSIVE_BLOOM_SIZE + +/datum/preference/numeric/emissive_bloom/apply_to_client(client/client, value) + // Update the plane master filter + var/datum/hud/my_hud = client.mob?.hud_used + if(!my_hud) + return + + for(var/atom/movable/screen/plane_master/bloom as anything in my_hud.get_true_plane_masters(RENDER_PLANE_EMISSIVE_BLOOM)) + if (!bloom.get_filter("emissive_bloom")) + if (value) + bloom.add_filter("emissive_bloom", 2, bloom_filter(threshold = COLOR_BLACK, size = value, offset = ceil(value / 2))) + continue + + if (value) + bloom.modify_filter("emissive_bloom", list("size" = value, "offset" = ceil(value / 2))) + else + bloom.remove_filter("emissive_bloom") diff --git a/tgstation.dme b/tgstation.dme index da561f0cec6..3a2ad869f73 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3989,6 +3989,7 @@ #include "code\modules\client\preferences\broadcast_login_logout.dm" #include "code\modules\client\preferences\chipped.dm" #include "code\modules\client\preferences\clothing.dm" +#include "code\modules\client\preferences\emissive_bloom.dm" #include "code\modules\client\preferences\food_allergy.dm" #include "code\modules\client\preferences\fps.dm" #include "code\modules\client\preferences\gender.dm" diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/emissive_bloom.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/emissive_bloom.tsx new file mode 100644 index 00000000000..11d48bac4ec --- /dev/null +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/emissive_bloom.tsx @@ -0,0 +1,8 @@ +import { type Feature, FeatureSliderInput } from '../base'; + +export const emissive_bloom: Feature = { + name: 'Emissive Bloom Strength', + category: 'GAMEPLAY', + description: `How strong the bloom on emissive objects, such as computer screens, is. This has negligible performance impact.`, + component: FeatureSliderInput, +};