|
@@ -9,6 +9,8 @@ extends Control
|
|
|
@onready var fps_label := $FPSLabel
|
|
|
@onready var resolution_label := $ResolutionLabel
|
|
|
|
|
|
+var counter := 0.0
|
|
|
+
|
|
|
# When the screen changes size, we need to update the 3D
|
|
|
# viewport quality setting. If we don't do this, the viewport will take
|
|
|
# the size from the main viewport.
|
|
@@ -28,7 +30,13 @@ func _ready() -> void:
|
|
|
|
|
|
|
|
|
func _process(delta: float) -> void:
|
|
|
+ counter += delta
|
|
|
+ # Hide FPS label until it's initially updated by the engine (this can take up to 1 second).
|
|
|
+ fps_label.visible = counter >= 1.0
|
|
|
fps_label.text = "%d FPS (%.2f mspf)" % [Engine.get_frames_per_second(), 1000.0 / Engine.get_frames_per_second()]
|
|
|
+ # Color FPS counter depending on framerate.
|
|
|
+ # The Gradient resource is stored as metadata within the FPSLabel node (accessible in the inspector).
|
|
|
+ fps_label.modulate = fps_label.get_meta("gradient").sample(remap(Engine.get_frames_per_second(), 0, 180, 0.0, 1.0))
|
|
|
|
|
|
|
|
|
func update_resolution_label() -> void:
|
|
@@ -84,8 +92,11 @@ func _on_filter_option_button_item_selected(index: int) -> void:
|
|
|
%FSRSharpnessSlider.visible = true
|
|
|
|
|
|
|
|
|
-func _on_fsr_sharpness_slider_value_changed(value):
|
|
|
- get_viewport().fsr_sharpness = value
|
|
|
+func _on_fsr_sharpness_slider_value_changed(value: float) -> void:
|
|
|
+ # Lower FSR sharpness values result in a sharper image.
|
|
|
+ # Invert the slider so that higher values result in a sharper image,
|
|
|
+ # which is generally expected from users.
|
|
|
+ get_viewport().fsr_sharpness = 2.0 - value
|
|
|
|
|
|
|
|
|
func _on_vsync_option_button_item_selected(index: int) -> void:
|
|
@@ -125,7 +136,7 @@ func _on_taa_option_button_item_selected(index: int) -> void:
|
|
|
func _on_fxaa_option_button_item_selected(index: int) -> void:
|
|
|
# Fast approximate anti-aliasing. Much faster than MSAA (and works on alpha scissor edges),
|
|
|
# but blurs the whole scene rendering slightly.
|
|
|
- get_viewport().screen_space_aa = index == 1
|
|
|
+ get_viewport().screen_space_aa = int(index == 1) as Viewport.ScreenSpaceAA
|
|
|
|
|
|
|
|
|
func _on_fullscreen_option_button_item_selected(index: int) -> void:
|
|
@@ -292,10 +303,8 @@ func _on_glow_option_button_item_selected(index: int) -> void:
|
|
|
world_environment.environment.glow_enabled = false
|
|
|
if index == 1: # Low
|
|
|
world_environment.environment.glow_enabled = true
|
|
|
- RenderingServer.environment_glow_set_use_high_quality(false)
|
|
|
if index == 2: # High
|
|
|
world_environment.environment.glow_enabled = true
|
|
|
- RenderingServer.environment_glow_set_use_high_quality(true)
|
|
|
|
|
|
|
|
|
func _on_volumetric_fog_option_button_item_selected(index: int) -> void:
|
|
@@ -338,6 +347,7 @@ func _on_saturation_slider_value_changed(value: float) -> void:
|
|
|
func _on_very_low_preset_pressed() -> void:
|
|
|
%TAAOptionButton.selected = 0
|
|
|
%MSAAOptionButton.selected = 0
|
|
|
+ %FXAAOptionButton.selected = 0
|
|
|
%ShadowSizeOptionButton.selected = 0
|
|
|
%ShadowFilterOptionButton.selected = 0
|
|
|
%MeshLODOptionButton.selected = 0
|
|
@@ -351,7 +361,8 @@ func _on_very_low_preset_pressed() -> void:
|
|
|
|
|
|
func _on_low_preset_pressed() -> void:
|
|
|
%TAAOptionButton.selected = 0
|
|
|
- %MSAAOptionButton.selected = 1
|
|
|
+ %MSAAOptionButton.selected = 0
|
|
|
+ %FXAAOptionButton.selected = 1
|
|
|
%ShadowSizeOptionButton.selected = 1
|
|
|
%ShadowFilterOptionButton.selected = 1
|
|
|
%MeshLODOptionButton.selected = 1
|
|
@@ -367,6 +378,7 @@ func _on_low_preset_pressed() -> void:
|
|
|
func _on_medium_preset_pressed() -> void:
|
|
|
%TAAOptionButton.selected = 1
|
|
|
%MSAAOptionButton.selected = 0
|
|
|
+ %FXAAOptionButton.selected = 0
|
|
|
%ShadowSizeOptionButton.selected = 2
|
|
|
%ShadowFilterOptionButton.selected = 2
|
|
|
%MeshLODOptionButton.selected = 1
|
|
@@ -382,6 +394,7 @@ func _on_medium_preset_pressed() -> void:
|
|
|
func _on_high_preset_pressed() -> void:
|
|
|
%TAAOptionButton.selected = 1
|
|
|
%MSAAOptionButton.selected = 0
|
|
|
+ %FXAAOptionButton.selected = 0
|
|
|
%ShadowSizeOptionButton.selected = 3
|
|
|
%ShadowFilterOptionButton.selected = 3
|
|
|
%MeshLODOptionButton.selected = 2
|
|
@@ -397,6 +410,7 @@ func _on_high_preset_pressed() -> void:
|
|
|
func _on_ultra_preset_pressed() -> void:
|
|
|
%TAAOptionButton.selected = 1
|
|
|
%MSAAOptionButton.selected = 1
|
|
|
+ %FXAAOptionButton.selected = 0
|
|
|
%ShadowSizeOptionButton.selected = 4
|
|
|
%ShadowFilterOptionButton.selected = 4
|
|
|
%MeshLODOptionButton.selected = 3
|
|
@@ -411,14 +425,15 @@ func _on_ultra_preset_pressed() -> void:
|
|
|
|
|
|
func update_preset() -> void:
|
|
|
# Simulate options being manually selected to run their respective update code.
|
|
|
- %TAAOptionButton.emit_signal("item_selected", %TAAOptionButton.selected)
|
|
|
- %MSAAOptionButton.emit_signal("item_selected", %MSAAOptionButton.selected)
|
|
|
- %ShadowSizeOptionButton.emit_signal("item_selected", %ShadowSizeOptionButton.selected)
|
|
|
- %ShadowFilterOptionButton.emit_signal("item_selected", %ShadowFilterOptionButton.selected)
|
|
|
- %MeshLODOptionButton.emit_signal("item_selected", %MeshLODOptionButton.selected)
|
|
|
- %SDFGIOptionButton.emit_signal("item_selected", %SDFGIOptionButton.selected)
|
|
|
- %GlowOptionButton.emit_signal("item_selected", %GlowOptionButton.selected)
|
|
|
- %SSAOOptionButton.emit_signal("item_selected", %SSAOOptionButton.selected)
|
|
|
- %SSReflectionsOptionButton.emit_signal("item_selected", %SSReflectionsOptionButton.selected)
|
|
|
- %SSILOptionButton.emit_signal("item_selected", %SSILOptionButton.selected)
|
|
|
- %VolumetricFogOptionButton.emit_signal("item_selected", %VolumetricFogOptionButton.selected)
|
|
|
+ %TAAOptionButton.item_selected.emit(%TAAOptionButton.selected)
|
|
|
+ %MSAAOptionButton.item_selected.emit(%MSAAOptionButton.selected)
|
|
|
+ %FXAAOptionButton.item_selected.emit(%FXAAOptionButton.selected)
|
|
|
+ %ShadowSizeOptionButton.item_selected.emit(%ShadowSizeOptionButton.selected)
|
|
|
+ %ShadowFilterOptionButton.item_selected.emit(%ShadowFilterOptionButton.selected)
|
|
|
+ %MeshLODOptionButton.item_selected.emit(%MeshLODOptionButton.selected)
|
|
|
+ %SDFGIOptionButton.item_selected.emit(%SDFGIOptionButton.selected)
|
|
|
+ %GlowOptionButton.item_selected.emit(%GlowOptionButton.selected)
|
|
|
+ %SSAOOptionButton.item_selected.emit(%SSAOOptionButton.selected)
|
|
|
+ %SSReflectionsOptionButton.item_selected.emit(%SSReflectionsOptionButton.selected)
|
|
|
+ %SSILOptionButton.item_selected.emit(%SSILOptionButton.selected)
|
|
|
+ %VolumetricFogOptionButton.item_selected.emit(%VolumetricFogOptionButton.selected)
|