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

63 lines
2.3 KiB
Plaintext
Raw Normal View History

-- @ Version: SCREEN SPACE SHADERS - UPDATE 22
-- @ Description: Terrain script
-- @ Author: https://www.moddb.com/members/ascii1457
-- @ Mod: https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders
-- Terrain setup
local ssfx_terrain_distance = 0
local ssfx_terrain_pom_quality = 0
local ssfx_terrain_pom_refine = 0
local ssfx_terrain_pom_range = 0
local ssfx_terrain_pom_height = 0
local ssfx_terrain_pom_water = 0
local ssfx_terrain_grass_align = 0
local ssfx_terrain_grass_slope = 0
-- Samples, Range, Height, Water Limit
function apply_terrain_settings()
get_console():execute("ssfx_terrain_quality (" .. ssfx_terrain_distance .. ",0,0,0)")
get_console():execute("ssfx_terrain_grass_align " .. (ssfx_terrain_grass_align and 1 or 0))
get_console():execute("ssfx_terrain_grass_slope " .. ssfx_terrain_grass_slope)
get_console():execute("ssfx_terrain_pom (" .. ssfx_terrain_pom_quality .. "," .. ssfx_terrain_pom_range .. "," .. ssfx_terrain_pom_height .."," .. ssfx_terrain_pom_water .. ")")
get_console():execute("ssfx_terrain_pom_refine " .. (ssfx_terrain_pom_refine and 1 or 0))
end
function on_option_change()
-- Get settings
ssfx_terrain_distance = ssfx_001_mcm.ssfx_get_setting("terrain", "distance", ssfx_terrain_settings)
ssfx_terrain_pom_quality = ssfx_001_mcm.ssfx_get_setting("terrain", "pom_quality", ssfx_terrain_settings)
ssfx_terrain_pom_refine = ssfx_001_mcm.ssfx_get_setting("terrain", "pom_refine", ssfx_terrain_settings)
ssfx_terrain_pom_range = ssfx_001_mcm.ssfx_get_setting("terrain", "pom_range", ssfx_terrain_settings)
ssfx_terrain_pom_height = ssfx_001_mcm.ssfx_get_setting("terrain", "pom_height", ssfx_terrain_settings)
ssfx_terrain_pom_water = ssfx_001_mcm.ssfx_get_setting("terrain", "pom_water_level", ssfx_terrain_settings)
ssfx_terrain_grass_align = ssfx_001_mcm.ssfx_get_setting("terrain", "grass_align", ssfx_terrain_settings)
ssfx_terrain_grass_slope = ssfx_001_mcm.ssfx_get_setting("terrain", "grass_slope", ssfx_terrain_settings)
-- Convert from degrees to 0 ~ 1
ssfx_terrain_grass_slope = ssfx_terrain_grass_slope / 90
-- Apply settings
apply_terrain_settings()
end
function on_game_start()
-- General Functions
RegisterScriptCallback("on_option_change", on_option_change)
-- Read and apply settigns
on_option_change()
end