From 3d2bae03a51f8f96f0983af11ff7bfe693e7dbd9 Mon Sep 17 00:00:00 2001 From: tpart Date: Thu, 4 Jul 2024 10:05:04 +0200 Subject: Add setting to disable shadows --- client/game.tscn | 6 ++++-- client/global.gd | 1 + client/map/auto_setup/environment_setup.gd | 27 +++++++++++++++++++++++++++ client/map/auto_setup/light_setup.gd | 24 ++++++++++++++++++++++++ client/map/environment_setup.gd | 27 --------------------------- client/menu/menu_background.tscn | 2 +- 6 files changed, 57 insertions(+), 30 deletions(-) create mode 100644 client/map/auto_setup/environment_setup.gd create mode 100644 client/map/auto_setup/light_setup.gd delete mode 100644 client/map/environment_setup.gd (limited to 'client') diff --git a/client/game.tscn b/client/game.tscn index 460cde3d..2489e04e 100644 --- a/client/game.tscn +++ b/client/game.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=11 format=3 uid="uid://c6krh36hoqfg8"] +[gd_scene load_steps=12 format=3 uid="uid://c6krh36hoqfg8"] [ext_resource type="Script" path="res://game.gd" id="1_sftfn"] [ext_resource type="PackedScene" uid="uid://b31mlnao6ybt8" path="res://player/follow_camera.tscn" id="2_s8y6o"] -[ext_resource type="Script" path="res://map/environment_setup.gd" id="4_hixq3"] +[ext_resource type="Script" path="res://map/auto_setup/environment_setup.gd" id="4_hixq3"] [ext_resource type="PackedScene" uid="uid://c0euiv7duqfp4" path="res://player/marker.tscn" id="4_igl0o"] +[ext_resource type="Script" path="res://map/auto_setup/light_setup.gd" id="5_6fpff"] [ext_resource type="Script" path="res://multiplayer.gd" id="6_fbxu8"] [ext_resource type="PackedScene" uid="uid://b4gone8fu53r7" path="res://map/map.tscn" id="6_prg6t"] [ext_resource type="PackedScene" uid="uid://bpikve6wlsjfl" path="res://menu/overlay.tscn" id="7_7xrr6"] @@ -41,6 +42,7 @@ script = ExtResource("4_hixq3") [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] transform = Transform3D(-0.412548, 0.834939, -0.364255, 4.90703e-08, 0.399869, 0.916572, 0.910936, 0.37813, -0.164965, 0, 0, 0) shadow_enabled = true +script = ExtResource("5_6fpff") [node name="Marker" parent="." instance=ExtResource("4_igl0o")] visible = false diff --git a/client/global.gd b/client/global.gd index db85a603..a8a34871 100644 --- a/client/global.gd +++ b/client/global.gd @@ -50,6 +50,7 @@ var default_settings := { "taa": ToggleSetting.new(tr("Temporal Anti-Aliasing"), false), "voxel_gi": ToggleSetting.new(tr("Use VoxelGI (Blocks the game on map update but is more accurate)"), false), "sdfgi": ToggleSetting.new(tr("Use SDFGI (Doesn't block the game but produces more artifacts)"), false), + "shadows": ToggleSetting.new(tr("Enable shadows"), true), "debug_info": ToggleSetting.new(tr("Display debug info (Framerate, etc.)"), false), "grass_amount": RangeSetting.new(tr("3D grass amount per grass tile"), 16, 0, 32), "setup_complete": ToggleSetting.new(tr("Initial setup complete. (Uncheck and restart to reenter)"), false), diff --git a/client/map/auto_setup/environment_setup.gd b/client/map/auto_setup/environment_setup.gd new file mode 100644 index 00000000..f163588b --- /dev/null +++ b/client/map/auto_setup/environment_setup.gd @@ -0,0 +1,27 @@ +# Undercooked - a game about cooking +# Copyright 2024 tpart +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +extends WorldEnvironment +class_name EnvironmentSetup + +@export var allow_sdfgi := true + +func _ready(): + apply_settings() + Global.settings_changed.connect(apply_settings) + +func apply_settings(): + environment.ssao_enabled = Global.get_setting("ssao") + environment.sdfgi_enabled = Global.get_setting("sdfgi") if allow_sdfgi else false diff --git a/client/map/auto_setup/light_setup.gd b/client/map/auto_setup/light_setup.gd new file mode 100644 index 00000000..c74fb5ee --- /dev/null +++ b/client/map/auto_setup/light_setup.gd @@ -0,0 +1,24 @@ +# Undercooked - a game about cooking +# Copyright 2024 tpart +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +extends DirectionalLight3D +class_name LightSetup + +func _ready(): + apply_settings() + Global.settings_changed.connect(apply_settings) + +func apply_settings(): + shadow_enabled = Global.get_setting("shadows") diff --git a/client/map/environment_setup.gd b/client/map/environment_setup.gd deleted file mode 100644 index f163588b..00000000 --- a/client/map/environment_setup.gd +++ /dev/null @@ -1,27 +0,0 @@ -# Undercooked - a game about cooking -# Copyright 2024 tpart -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, version 3 of the License only. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -extends WorldEnvironment -class_name EnvironmentSetup - -@export var allow_sdfgi := true - -func _ready(): - apply_settings() - Global.settings_changed.connect(apply_settings) - -func apply_settings(): - environment.ssao_enabled = Global.get_setting("ssao") - environment.sdfgi_enabled = Global.get_setting("sdfgi") if allow_sdfgi else false diff --git a/client/menu/menu_background.tscn b/client/menu/menu_background.tscn index b4abe291..c0335fdc 100644 --- a/client/menu/menu_background.tscn +++ b/client/menu/menu_background.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=12 format=3 uid="uid://l4vm07dtda4j"] [ext_resource type="Script" path="res://menu/menu_background.gd" id="1_ijsg0"] -[ext_resource type="Script" path="res://map/environment_setup.gd" id="2_rkilw"] +[ext_resource type="Script" path="res://map/auto_setup/environment_setup.gd" id="2_rkilw"] [ext_resource type="Shader" path="res://menu/menu_background.gdshader" id="3_5mp8y"] [ext_resource type="PackedScene" uid="uid://b4gone8fu53r7" path="res://map/map.tscn" id="3_p80a7"] -- cgit v1.2.3-70-g09d2