2024-02-12 09:56:55 +00:00
|
|
|
class_name RenderScale
|
2024-02-05 22:42:04 +00:00
|
|
|
extends OptionButton
|
|
|
|
|
2024-02-12 09:56:55 +00:00
|
|
|
static var fsrQuality: Array[float] = [0.50, 0.59, 0.67, 0.77, 1.0]
|
2024-02-05 22:42:04 +00:00
|
|
|
|
|
|
|
func _ready():
|
2024-02-10 18:21:10 +00:00
|
|
|
var viewport_scale := get_viewport().scaling_3d_scale
|
2024-02-05 22:42:04 +00:00
|
|
|
var closest := -1
|
|
|
|
var closest_diff := 999.0
|
|
|
|
|
|
|
|
for index in range(item_count):
|
|
|
|
var diff: float = abs(viewport_scale - fsrQuality[index])
|
|
|
|
|
|
|
|
if diff < closest_diff:
|
|
|
|
closest = index
|
|
|
|
closest_diff = diff
|
|
|
|
|
|
|
|
selected = closest
|
|
|
|
|
|
|
|
func on_item_selected(index):
|
2024-02-10 18:21:10 +00:00
|
|
|
get_viewport().scaling_3d_scale = fsrQuality[index]
|