Divergent/mods/Screen Space Shaders/gamedata/scripts/ssfx_water.script

70 lines
2.5 KiB
Plaintext
Raw Normal View History

-- @ Version: SCREEN SPACE SHADERS - UPDATE 21
-- @ Description: Water script
-- @ Author: https://www.moddb.com/members/ascii1457
-- @ Mod: https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders
-- Settings
local ssfx_water_res = 0
local ssfx_water_blur = 0
local ssfx_water_blur_pattern = 0
local ssfx_water_parallax_height = 0
local ssfx_water_distortion = 0
local ssfx_water_turbidity = 0
local ssfx_water_softborder = 0
local ssfx_water_reflection = 0
local ssfx_water_specular = 0
local ssfx_water_caustics = 0
local ssfx_water_ripples = 0
-- Internal vars
module_installed = true
local function apply_water_settings()
-- Apply commands
get_console():execute("ssfx_water (" .. ssfx_water_res .. "," .. ssfx_water_blur .. "," .. ssfx_water_blur_pattern .. ",0)")
get_console():execute("ssfx_water_setup1 (" .. ssfx_water_distortion .. "," .. ssfx_water_turbidity .. "," .. ssfx_water_softborder .."," .. ssfx_water_parallax_height .. ")")
get_console():execute("ssfx_water_setup2 (" .. ssfx_water_reflection .. "," .. ssfx_water_specular .. "," .. ssfx_water_caustics .."," .. ssfx_water_ripples .. ")")
end
local function update_settings()
-- Get settings
module_id = "water"
ssfx_water_res = ssfx_001_mcm.ssfx_get_setting(module_id, "ssr_res", ssfx_water_settings)
ssfx_water_blur = ssfx_001_mcm.ssfx_get_setting(module_id, "blur", ssfx_water_settings)
ssfx_water_blur_pattern = ssfx_001_mcm.ssfx_get_setting(module_id, "blur_pattern", ssfx_water_settings)
ssfx_water_parallax_height = ssfx_001_mcm.ssfx_get_setting(module_id, "parallax_height", ssfx_water_settings)
ssfx_water_distortion = ssfx_001_mcm.ssfx_get_setting(module_id, "distortion", ssfx_water_settings)
ssfx_water_turbidity = ssfx_001_mcm.ssfx_get_setting(module_id, "turbidity", ssfx_water_settings) * 10
ssfx_water_softborder = ssfx_001_mcm.ssfx_get_setting(module_id, "softborder", ssfx_water_settings)
ssfx_water_reflection = ssfx_001_mcm.ssfx_get_setting(module_id, "reflection_int", ssfx_water_settings)
ssfx_water_specular = ssfx_001_mcm.ssfx_get_setting(module_id, "specular_int", ssfx_water_settings) * 6
ssfx_water_caustics = ssfx_001_mcm.ssfx_get_setting(module_id, "caustics_int", ssfx_water_settings)
ssfx_water_ripples = ssfx_001_mcm.ssfx_get_setting(module_id, "ripples_int", ssfx_water_settings)
ssfx_water_res = 1.0 / ssfx_water_res
-- Apply settings
apply_water_settings()
end
function on_game_start()
-- General Functions
RegisterScriptCallback("on_option_change", update_settings)
-- Read and apply settigns
update_settings()
end