diff --git a/Game/Assets/UI/GUI.gd b/Game/Assets/UI/GUI.gd index 3ee3da6..c6537b2 100644 --- a/Game/Assets/UI/GUI.gd +++ b/Game/Assets/UI/GUI.gd @@ -3,6 +3,8 @@ extends Control var settings_filename = "user://settings.save" var settings = {} +var map: Node3D + func _ready(): if has_settings(): load_settings() @@ -11,8 +13,9 @@ func _ready(): settings = {'Fullscreen':true, 'Sensitivity':0.5, 'ip':'liblast.unfa.xyz', - 'player color':Color(1, 0, 0, 1), - 'username':'nameless' + 'player color':Color(1, 1, 1, 1), + 'username':'player', + 'GraphicsRenderScale':1.0, } apply_settings() save_settings() @@ -41,12 +44,13 @@ func load_settings(): settings = {} func apply_settings(): + # get the currently loaded map + map = get_tree().get_root().get_node("Main").get_node("Map") + for key in settings.keys(): match key: "Sensitivity": set_mouse_sensitivity(settings[key]) - "GraphicsEyeCandyLighting": - set_lighting(settings[key]) "GraphicsFullscreen": set_fullscreen(settings[key]) "GraphicsAmbientOcclusion": @@ -99,13 +103,6 @@ func set_fullscreen(is_fullscreen): else: get_tree().get_root().mode = Window.MODE_WINDOWED -func set_lighting(is_enabled): - var map = get_tree().get_root().get_node("Main").get_node("Map") - - #map.get_node("Lights").visible = is_enabled - #map.get_node("Decals").visible = is_enabled - #map.get_node("ReflectionProbes").visible = is_enabled - func set_ambient_occlusion(is_enabled): # TODO pass @@ -153,3 +150,9 @@ func set_decals_decals(is_enabled): func set_dynamic_lights(is_enabled): # TODO pass + +func set_render_scale(value): + get_viewport().scaling_3d_scale = value + +func set_fsr(is_enabled): + get_viewport().scaling_3d_mode = Viewport.SCALING_3D_MODE_FSR if is_enabled else Viewport.SCALING_3D_MODE_BILINEAR diff --git a/Game/Assets/UI/GraphicsMenu.gd b/Game/Assets/UI/GraphicsMenu.gd index b701d77..29cff34 100644 --- a/Game/Assets/UI/GraphicsMenu.gd +++ b/Game/Assets/UI/GraphicsMenu.gd @@ -69,3 +69,22 @@ func on_dynamic_lights_toggled(button_pressed): if GUI: GUI.set_dynamic_lights(button_pressed) $DynamicLights.save_data() + +func on_FSR_toggled(button_pressed): + if GUI: + GUI.set_fsr(button_pressed) + $FSR.save_data() + +func _on_RenderScale_value_changed(value): + var value_map = { + 0: 0.25, + 1: 0.5, + 2: 0.75, + 3: 1.0, + 4: 2.0, + 5: 4.0, + 6: 8.0, + } + if GUI: + GUI.set_render_scale(value_map.get(value as int)) + $RenderScale.save_data() diff --git a/Game/Assets/UI/GraphicsMenu.tscn b/Game/Assets/UI/GraphicsMenu.tscn index 0d6c6c0..3824cf2 100644 --- a/Game/Assets/UI/GraphicsMenu.tscn +++ b/Game/Assets/UI/GraphicsMenu.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=3 uid="uid://cd6qhohan2oa1"] +[gd_scene load_steps=5 format=3 uid="uid://cd6qhohan2oa1"] [ext_resource type="PackedScene" uid="uid://81ymy0o073e5" path="res://Assets/UI/Menu.tscn" id="1"] [ext_resource type="Script" path="res://Assets/UI/GraphicsMenu.gd" id="2"] [ext_resource type="PackedScene" uid="uid://bl1fc5cl4fcav" path="res://Assets/UI/MenuCheckButton.tscn" id="3"] +[ext_resource type="PackedScene" uid="uid://bwqwic7ex6muv" path="res://Assets/UI/MenuSlider.tscn" id="4_txfvn"] [node name="GraphicsMenu" instance=ExtResource( "1" )] script = ExtResource( "2" ) @@ -16,129 +17,151 @@ theme_override_font_sizes/font_size = 16 label = "Fullscreen" index = "GraphicsFullscreen" -[node name="Lighting" parent="." index="1" instance=ExtResource( "3" )] +[node name="AmbientOcclusion" parent="." index="1" instance=ExtResource( "3" )] anchor_right = 0.0 anchor_bottom = 0.0 offset_top = 44.0 offset_right = 250.0 offset_bottom = 84.0 -label = "Eye Candy Lighting" -index = "GraphicsEyeCandyLighting" +label = "Ambient Occlusion" +index = "GraphicsAmbientOcclusion" -[node name="AmbientOcclusion" parent="." index="2" instance=ExtResource( "3" )] +[node name="Shadows" parent="." index="2" instance=ExtResource( "3" )] anchor_right = 0.0 anchor_bottom = 0.0 offset_top = 88.0 offset_right = 250.0 offset_bottom = 128.0 -label = "Ambient Occlusion" -index = "GraphicsAmbientOcclusion" +label = "Shadows" +index = "GraphicsShadows" -[node name="Shadows" parent="." index="3" instance=ExtResource( "3" )] +[node name="GlobalIllumination" parent="." index="3" instance=ExtResource( "3" )] anchor_right = 0.0 anchor_bottom = 0.0 offset_top = 132.0 offset_right = 250.0 offset_bottom = 172.0 -label = "Shadows" -index = "GraphicsShadows" +label = "Global Illumination" +index = "GraphicsGlobalIllumination" -[node name="GlobalIllumination" parent="." index="4" instance=ExtResource( "3" )] +[node name="ScreenSpaceReflections" parent="." index="4" instance=ExtResource( "3" )] anchor_right = 0.0 anchor_bottom = 0.0 offset_top = 176.0 offset_right = 250.0 offset_bottom = 216.0 -label = "Global Illumination" -index = "GraphicsGlobalIllumination" +label = "Screen Space Reflections" +index = "GraphicsScreenSpaceReflections" -[node name="ScreenSpaceReflections" parent="." index="5" instance=ExtResource( "3" )] +[node name="ReflectionProbes" parent="." index="5" instance=ExtResource( "3" )] anchor_right = 0.0 anchor_bottom = 0.0 offset_top = 220.0 offset_right = 250.0 offset_bottom = 260.0 -label = "Screen Space Reflections" -index = "GraphicsScreenSpaceReflections" +label = "Reflection Probes" +index = "GraphicsReflectionProbes" -[node name="ReflectionProbes" parent="." index="6" instance=ExtResource( "3" )] +[node name="Glow" parent="." index="6" instance=ExtResource( "3" )] anchor_right = 0.0 anchor_bottom = 0.0 offset_top = 264.0 offset_right = 250.0 offset_bottom = 304.0 -label = "Reflection Probes" -index = "GraphicsReflectionProbes" +label = "Glow" +index = "GraphicsGlow" -[node name="Glow" parent="." index="7" instance=ExtResource( "3" )] +[node name="MSAA" parent="." index="7" instance=ExtResource( "3" )] anchor_right = 0.0 anchor_bottom = 0.0 offset_top = 308.0 offset_right = 250.0 offset_bottom = 348.0 -label = "Glow" -index = "GraphicsGlow" +label = "MSAA" +index = "GraphicsMSAA" -[node name="MSAA" parent="." index="8" instance=ExtResource( "3" )] +[node name="FXAA" parent="." index="8" instance=ExtResource( "3" )] anchor_right = 0.0 anchor_bottom = 0.0 offset_top = 352.0 offset_right = 250.0 offset_bottom = 392.0 -label = "MSAA" -index = "GraphicsMSAA" +label = "FXAA" +index = "GraphicsFXAA" -[node name="FXAA" parent="." index="9" instance=ExtResource( "3" )] +[node name="RenderScale" parent="." index="9" instance=ExtResource( "4_txfvn" )] anchor_right = 0.0 anchor_bottom = 0.0 offset_top = 396.0 offset_right = 250.0 -offset_bottom = 436.0 -label = "FXAA" -index = "GraphicsFXAA" +offset_bottom = 419.0 +label = "Render Scale" +index = "graphics_render_scale" -[node name="Debanding" parent="." index="10" instance=ExtResource( "3" )] +[node name="Label" parent="RenderScale" index="0"] +offset_top = 0.0 +offset_right = 46.0 +offset_bottom = 23.0 + +[node name="Slider" parent="RenderScale" index="1"] +offset_left = 50.0 +offset_right = 250.0 +max_value = 6.0 +value = 3.0 +scrollable = false +tick_count = 7 +ticks_on_borders = true + +[node name="FSR" parent="." index="10" instance=ExtResource( "3" )] anchor_right = 0.0 anchor_bottom = 0.0 -offset_top = 440.0 +offset_top = 423.0 offset_right = 250.0 -offset_bottom = 480.0 +offset_bottom = 463.0 +label = "FSR" +index = "GraphicsFSR" + +[node name="Debanding" parent="." index="11" instance=ExtResource( "3" )] +anchor_right = 0.0 +anchor_bottom = 0.0 +offset_top = 467.0 +offset_right = 250.0 +offset_bottom = 507.0 label = "Debanding" index = "GraphicsDebanding" -[node name="DecalsStatic" parent="." index="11" instance=ExtResource( "3" )] +[node name="DecalsStatic" parent="." index="12" instance=ExtResource( "3" )] anchor_right = 0.0 anchor_bottom = 0.0 -offset_top = 484.0 +offset_top = 511.0 offset_right = 250.0 -offset_bottom = 524.0 +offset_bottom = 551.0 label = "Decals Static" index = "GraphicsDecalsStatic" -[node name="DecalsDecals" parent="." index="12" instance=ExtResource( "3" )] +[node name="DecalsDecals" parent="." index="13" instance=ExtResource( "3" )] anchor_right = 0.0 anchor_bottom = 0.0 -offset_top = 528.0 +offset_top = 555.0 offset_right = 250.0 -offset_bottom = 568.0 +offset_bottom = 595.0 label = "Decals Decals" index = "GraphicsDecalsDecals" -[node name="DynamicLights" parent="." index="13" instance=ExtResource( "3" )] +[node name="DynamicLights" parent="." index="14" instance=ExtResource( "3" )] anchor_right = 0.0 anchor_bottom = 0.0 -offset_top = 572.0 +offset_top = 599.0 offset_right = 250.0 -offset_bottom = 612.0 +offset_bottom = 639.0 label = "Dynamic Lights" index = "GraphicsDynamicLights" -[node name="Back" parent="." index="14"] -offset_top = 616.0 -offset_bottom = 645.0 +[node name="Back" parent="." index="15"] +offset_top = 643.0 +offset_bottom = 672.0 [connection signal="toggled" from="Fullscreen" to="." method="on_fullscreen_toggled"] -[connection signal="toggled" from="Lighting" to="." method="on_lighting_toggled"] [connection signal="toggled" from="AmbientOcclusion" to="." method="on_ambient_occlusion_toggled"] [connection signal="toggled" from="Shadows" to="." method="on_shadows_toggled"] [connection signal="toggled" from="GlobalIllumination" to="." method="on_global_illumination_toggled"] @@ -147,7 +170,11 @@ offset_bottom = 645.0 [connection signal="toggled" from="Glow" to="." method="on_glow_toggled"] [connection signal="toggled" from="MSAA" to="." method="on_MSAA_toggled"] [connection signal="toggled" from="FXAA" to="." method="on_FXAA_toggled"] +[connection signal="value_changed" from="RenderScale/Slider" to="." method="_on_RenderScale_value_changed"] +[connection signal="toggled" from="FSR" to="." method="on_FSR_toggled"] [connection signal="toggled" from="Debanding" to="." method="on_debanding_toggled"] [connection signal="toggled" from="DecalsStatic" to="." method="on_decals_static_toggled"] [connection signal="toggled" from="DecalsDecals" to="." method="on_decals_decals_toggled"] [connection signal="toggled" from="DynamicLights" to="." method="on_dynamic_lights_toggled"] + +[editable path="RenderScale"]