add env shadows; add clouds and wind parameters for sky and envshadwows

This commit is contained in:
2026-03-27 13:22:39 +01:00
parent 052f200c5d
commit 2f4fd27dfd
17 changed files with 496 additions and 29 deletions

View File

@@ -1,11 +1,9 @@
class_name DayNightController
extends Node
#Time duration in seconds for a day
@export var day_duration: float = 120.0
#starting time
@export_range(0.0, 1.0) var start_time: float = 0.0
var environment_config: EnvironmentConfig
#Multiply for debug
@export var time_scale: float = 1.0
@@ -16,16 +14,23 @@ signal time_changed(time: float)
var current_time: float = 0.0
func _init(environmentconfig: EnvironmentConfig) -> void:
environment_config = environmentconfig
func _ready() -> void:
#connect events
UIEvents.set_day_time.connect(_on_set_day_time)
UIEvents.toggle_pause_daytime.connect(_on_toggle_pause_daytime)
current_time = start_time
update_time(current_time)
UIEvents.set_day_time.connect(_on_set_day_time)
func _process(delta: float) -> void:
if paused or day_duration <= 0.0:
if paused or environment_config.day_duration <= 0.0:
return
var increment: float = (delta * time_scale) / day_duration
var increment: float = (delta * time_scale) / environment_config.day_duration
current_time = wrapf(current_time + increment, 0.0, 1.0)
update_time(current_time)
@@ -46,3 +51,6 @@ func update_time(currtime: float) -> void:
func _on_set_day_time(value: float) -> void:
set_time(value)
func _on_toggle_pause_daytime(value: bool) -> void:
paused = value