48 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			GDScript
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			GDScript
		
	
	
	
	
	
extends Panel
 | 
						||
 | 
						||
@export var thisTab = 0
 | 
						||
 | 
						||
func _ready() -> void:
 | 
						||
	$AAOption.select(get_viewport().msaa_3d)
 | 
						||
	$SSAAOption.select(get_viewport().screen_space_aa)
 | 
						||
	$ShadowsOption.select(GlobalVariables.shadows)
 | 
						||
	$FOVSlider.value = GlobalVariables.FOV
 | 
						||
	$FOVSlider/CurrentLabel.text = str(int(GlobalVariables.FOV))
 | 
						||
	$VSyncOption.select(GlobalVariables.vsync)
 | 
						||
 | 
						||
func _on_tab_bar_tab_changed(tab: int) -> void:
 | 
						||
	if (thisTab == tab):
 | 
						||
		visible = true
 | 
						||
	else:
 | 
						||
		visible = false
 | 
						||
 | 
						||
func _on_fov_slider_value_changed(value: float) -> void:
 | 
						||
	GlobalVariables.FOV = value
 | 
						||
	$FOVSlider/CurrentLabel.text = str(int(value))
 | 
						||
	GlobalVariables.updateConfig()
 | 
						||
 | 
						||
func _on_option_aa_ss_item_selected(index: int) -> void:
 | 
						||
	get_viewport().screen_space_aa = int(index == 1) as Viewport.ScreenSpaceAA
 | 
						||
	GlobalVariables.updateConfig()
 | 
						||
 | 
						||
func _on_option_aa_msaa_item_selected(index: int) -> void:
 | 
						||
	if index == 0: # Disabled
 | 
						||
		get_viewport().msaa_3d = Viewport.MSAA_DISABLED
 | 
						||
	elif index == 1: # 2×
 | 
						||
		get_viewport().msaa_3d = Viewport.MSAA_2X
 | 
						||
	elif index == 2: # 4×
 | 
						||
		get_viewport().msaa_3d = Viewport.MSAA_4X
 | 
						||
	elif index == 3: # 8×
 | 
						||
		get_viewport().msaa_3d = Viewport.MSAA_8X
 | 
						||
	GlobalVariables.updateConfig()
 | 
						||
 | 
						||
func _on_shadows_option_item_selected(index: int) -> void:
 | 
						||
	GlobalVariables.shadows = index
 | 
						||
	get_tree().set_group("lights", "shadow_enabled", index == 1)
 | 
						||
	GlobalVariables.updateConfig()
 | 
						||
 | 
						||
 | 
						||
func _on_v_sync_option_item_selected(index: int) -> void:
 | 
						||
	GlobalVariables.vsync = index
 | 
						||
	DisplayServer.window_set_vsync_mode(index as DisplayServer.VSyncMode)
 | 
						||
	GlobalVariables.updateConfig()
 |