xrjamfeb2025/scenes/performance_settings/performance_settings.gd
2025-02-14 15:43:06 -07:00

39 lines
1.1 KiB
GDScript

class_name PerformanceSettings
extends Node
var environment: Environment = preload("res://scenes/environment.tres")
signal voxel_gi_changed(enabled: bool)
var voxel_gi_enabled := true
var bloom_enabled := true
var volumetric_fog_enabled := true
func get_voxel_gi_enabled() -> bool:
return voxel_gi_enabled
func _ready() -> void:
# Initialize environment settings
environment.glow_enabled = bloom_enabled
environment.volumetric_fog_enabled = volumetric_fog_enabled
_update_voxel_gi()
func toggle_voxel_gi(enabled: bool) -> void:
voxel_gi_enabled = enabled
_update_voxel_gi()
func toggle_bloom(enabled: bool) -> void:
bloom_enabled = enabled
environment.glow_enabled = bloom_enabled
func toggle_volumetric_fog(enabled: bool) -> void:
volumetric_fog_enabled = enabled
environment.volumetric_fog_enabled = volumetric_fog_enabled
func _update_voxel_gi() -> void:
voxel_gi_changed.emit(voxel_gi_enabled)
var voxel_gi = get_tree().current_scene.get_node_or_null("VoxelGI")
if voxel_gi:
voxel_gi.visible = voxel_gi_enabled
else:
print("couldn't find VoxelGI!")