add rain sound + add time to screen

This commit is contained in:
2026-04-09 14:21:16 +02:00
parent ecaa3704d7
commit 65294c7011
32 changed files with 383 additions and 234 deletions

View File

@@ -1,8 +1,6 @@
class_name DayNightController
extends Node
#starting time
@export_range(0.0, 1.0) var start_time: float = 0.0
var environment_config: EnvironmentConfig
#Multiply for debug
@@ -22,7 +20,7 @@ func _ready() -> void:
UIEvents.set_day_time.connect(_on_set_day_time)
UIEvents.toggle_pause_daytime.connect(_on_toggle_pause_daytime)
current_time = start_time
current_time = environment_config.start_time
update_time(current_time)
func _process(delta: float) -> void:
@@ -35,7 +33,7 @@ func _process(delta: float) -> void:
update_time(current_time)
func get_time_string() -> String:
var total_minutes: int = int(current_time * 1440.0) # 1440 = 24*60
var total_minutes: int = int(current_time * 1440.0)
@warning_ignore("integer_division")
var hours: int = int(total_minutes / 60)
var minutes: int = total_minutes % 60
@@ -47,6 +45,7 @@ func set_time(t: float) -> void:
func update_time(currtime: float) -> void:
emit_signal("time_changed", currtime)
UIEvents.day_time_changed.emit(currtime, get_time_string())
func _on_set_day_time(value: float) -> void:
set_time(value)

View File

@@ -10,8 +10,11 @@ var parameter_storage_buffer := RID()
func _init() -> void:
effect_callback_type = CompositorEffect.EFFECT_CALLBACK_TYPE_POST_OPAQUE
rd = RenderingServer.get_rendering_device()
if rd == null:
return
RenderingServer.call_on_render_thread(_initialize_compute)
var data := PackedFloat32Array()
data.resize(20)
data.fill(0)
@@ -24,7 +27,7 @@ func _init() -> void:
# alerts us we are about to be destroyed.
func _notification(what: int) -> void:
if what == NOTIFICATION_PREDELETE:
if shader.is_valid():
if rd != null and shader.is_valid():
# Freeing our shader will also free any dependents such as the pipeline!
rd.free_rid(shader)

View File

@@ -227,6 +227,8 @@ godray = ExtResource("5_411rw")
environment_dust = NodePath("EnvironmentDust")
blur = NodePath("Blur")
environment_shadows = NodePath("EnvironmentCloudsShadows")
thunder_sounds = null
rain_sounds = null
[node name="Particles_Fireflies" type="GPUParticles3D" parent="." unique_id=947538133]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
@@ -286,5 +288,3 @@ mouse_filter = 2
extra_cull_margin = 16384.0
mesh = SubResource("QuadMesh_sxgg7")
surface_material_override/0 = SubResource("ShaderMaterial_oqt1s")
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="." unique_id=902982869]

View File

@@ -18,11 +18,11 @@ extends Node3D
@export_group("Sound")
@export var thunder_sounds: Array[AudioStream]
@export var rain_sounds: Array[AudioStream]
#environment nodes
@onready var sun: DirectionalLight3D = $"../DirectionalLight3D"
@onready var environment: WorldEnvironment = $"../WorldEnvironment"
@onready var audio_player: AudioStreamPlayer3D = $AudioStreamPlayer3D
var day_night_controller: DayNightController
var weather_controller: WeatherController
@@ -51,16 +51,16 @@ func _ready() -> void:
particles_snow,
particles_fireflies,
particles_rain,
godray,
godray,
environment_dust,
blur,
environment_shadows,
sun,
sun,
environment,
environment_config,
camera,
audio_player,
thunder_sounds
thunder_sounds,
rain_sounds
)
weather_controller.name = "WeatherController"
add_child(weather_controller)
@@ -68,7 +68,7 @@ func _ready() -> void:
func ApplyWindNoiseToMaterials():
var noise_tex = preload("res://core/daynight/noise.tres")
for node in get_tree().get_nodes_in_group("wind_node"):
if node is GeometryInstance3D:
if node is GeometryInstance3D and node.material_override != null:
node.material_override.set_shader_parameter("wind_noise", noise_tex)
func ApplyWeatherShaderToMaterials():
@@ -83,26 +83,36 @@ func ApplyWeatherShaderToMaterials():
child.material_overlay = weather_shader
func select_day_time(normalized_time: float) -> void:
# 0.0→0.25 = sunrise: day_time 1.0→2.0 (night colors → morning colors)
# 0.25→0.5 = day: day_time 2.0→2.0 (stays morning/afternoon)
# 0.5→0.75 = sunset: day_time 2.0→3.0 (afternoon colors → night colors)
# 0.75→1.0 = night: day_time 3.0→3.0 (stays night)
# At wrap 1.0→0.0: day_time stays 3.0, then fades back via sunrise
#set show_day_time_debug = true to show debug on screen
#normalized_time is a value between 0 and 1; the time of the day is calculate as "normalized_time" * 1440; day_time is the step to pass from sunrise, to day, to sunset, to night
#e.g.
#Time normalized_time day_time
#00:00 0.0000 3.0
#06:00 0.2500 1.0
#09:36 0.4000 1.75
#10:48 0.4500 2.0
#12:00 0.5000 2.0
#19:12 0.8000 2.0
#21:36 0.9000 2.5
#24:00 1.0000 3.0
if normalized_time < 0.25:
if normalized_time < environment_config.sunrise:
#Sunrise: night → morning
day_time = 3.0 - (normalized_time / 0.25) * 2.0 # 3.0 → 1.0
elif normalized_time < 0.5:
#Broad daylight
var t: float = (normalized_time - 0.25) / 0.25
day_time = 3.0 - (normalized_time / environment_config.sunrise) * 2.0 # 3.0 → 1.0
elif normalized_time < environment_config.day:
#Morning: morning → afternoon
var t: float = (normalized_time - environment_config.sunrise) / (environment_config.day - environment_config.sunrise)
day_time = 1.0 + t # 1.0 → 2.0
elif normalized_time < 0.75:
elif normalized_time < environment_config.sunset:
#Broad daylight
day_time = 2.0
elif normalized_time < environment_config.night:
#Sunset: afternoon → night
var t: float = (normalized_time - 0.5) / 0.25
var t: float = (normalized_time - environment_config.sunset) / (environment_config.night - environment_config.sunset)
day_time = 2.0 + t # 2.0 → 3.0
else:
#Night
day_time = 3.0
if weather_controller:
weather_controller.day_time = day_time

View File

@@ -1,19 +0,0 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bfn6kxtpb8b7a"
path="res://.godot/imported/thunder_1.mp3-5dfac75637d4484715fa2c52227bbb39.mp3str"
[deps]
source_file="res://core/daynight/sound/thunder_1.mp3"
dest_files=["res://.godot/imported/thunder_1.mp3-5dfac75637d4484715fa2c52227bbb39.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@@ -1,19 +0,0 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://br2ye0dto487h"
path="res://.godot/imported/thunder_2.mp3-e0bc5cdbb7a7380e5c0e7af073c47559.mp3str"
[deps]
source_file="res://core/daynight/sound/thunder_2.mp3"
dest_files=["res://.godot/imported/thunder_2.mp3-e0bc5cdbb7a7380e5c0e7af073c47559.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@@ -1,19 +0,0 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://dvabvoqyya0g5"
path="res://.godot/imported/thunder_3.mp3-2057b93f6a6b1db545b448579512d302.mp3str"
[deps]
source_file="res://core/daynight/sound/thunder_3.mp3"
dest_files=["res://.godot/imported/thunder_3.mp3-2057b93f6a6b1db545b448579512d302.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@@ -1,19 +0,0 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://creenugno7hm"
path="res://.godot/imported/thunder_4.mp3-ab350a8d3ed7b106a20bdb2005be826d.mp3str"
[deps]
source_file="res://core/daynight/sound/thunder_4.mp3"
dest_files=["res://.godot/imported/thunder_4.mp3-ab350a8d3ed7b106a20bdb2005be826d.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@@ -1,19 +0,0 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bm6dq4jwsbxf6"
path="res://.godot/imported/thunder_5.mp3-bac65d0a703be3ab04d2144b8eef2bce.mp3str"
[deps]
source_file="res://core/daynight/sound/thunder_5.mp3"
dest_files=["res://.godot/imported/thunder_5.mp3-bac65d0a703be3ab04d2144b8eef2bce.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://byuxpukhy72n8"
path="res://.godot/imported/rain_1.mp3-b38c5c2051e16525931f27bf63462ca9.mp3str"
[deps]
source_file="res://core/daynight/sounds/rain_1.mp3"
dest_files=["res://.godot/imported/rain_1.mp3-b38c5c2051e16525931f27bf63462ca9.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://h5yhjn1x3f4j"
path="res://.godot/imported/rain_2.mp3-bcb3e8cb8ab98e668d60ed670be6de0f.mp3str"
[deps]
source_file="res://core/daynight/sounds/rain_2.mp3"
dest_files=["res://.godot/imported/rain_2.mp3-bcb3e8cb8ab98e668d60ed670be6de0f.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://elrjw0smm0cj"
path="res://.godot/imported/rain_3.mp3-b39c461eabf9a5f3502ac452c08310c1.mp3str"
[deps]
source_file="res://core/daynight/sounds/rain_3.mp3"
dest_files=["res://.godot/imported/rain_3.mp3-b39c461eabf9a5f3502ac452c08310c1.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bfn6kxtpb8b7a"
path="res://.godot/imported/thunder_1.mp3-a69332dc48adeec56bf6cc67c3bb4ceb.mp3str"
[deps]
source_file="res://core/daynight/sounds/thunder_1.mp3"
dest_files=["res://.godot/imported/thunder_1.mp3-a69332dc48adeec56bf6cc67c3bb4ceb.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://br2ye0dto487h"
path="res://.godot/imported/thunder_2.mp3-928b4a280c9174e8f9ec4888d6e47d04.mp3str"
[deps]
source_file="res://core/daynight/sounds/thunder_2.mp3"
dest_files=["res://.godot/imported/thunder_2.mp3-928b4a280c9174e8f9ec4888d6e47d04.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://dvabvoqyya0g5"
path="res://.godot/imported/thunder_3.mp3-af1ebec5599ef6a58950c7f353a6f8dd.mp3str"
[deps]
source_file="res://core/daynight/sounds/thunder_3.mp3"
dest_files=["res://.godot/imported/thunder_3.mp3-af1ebec5599ef6a58950c7f353a6f8dd.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://creenugno7hm"
path="res://.godot/imported/thunder_4.mp3-3b7e59285fedb20a25988d2987168f33.mp3str"
[deps]
source_file="res://core/daynight/sounds/thunder_4.mp3"
dest_files=["res://.godot/imported/thunder_4.mp3-3b7e59285fedb20a25988d2987168f33.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bm6dq4jwsbxf6"
path="res://.godot/imported/thunder_5.mp3-2dadd721b078f5baaa97664ed875a6b4.mp3str"
[deps]
source_file="res://core/daynight/sounds/thunder_5.mp3"
dest_files=["res://.godot/imported/thunder_5.mp3-2dadd721b078f5baaa97664ed875a6b4.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@@ -1,8 +1,10 @@
class_name WeatherController
extends Node
var audio_player: AudioStreamPlayer3D
var thunder_audio_player: AudioStreamPlayer
var thunder_sounds: Array[AudioStream]
var rain_sounds: Array[AudioStream]
var rain_audio_player: AudioStreamPlayer
var particles_wind: GPUParticles3D
var particles_snow: GPUParticles3D
@@ -27,6 +29,7 @@ var timer_next_lightning: float = 0.0
var is_raining: bool = false
var rain_intensity: float = 0.0
var rain_tween: Tween
var rain_audio_tween: Tween
var puddle_tween: Tween
var puddle_amount: float = 0.0
@@ -45,7 +48,7 @@ func _init(wind: GPUParticles3D, snow: GPUParticles3D,
fireflies: GPUParticles3D, rain: GPUParticles3D, ray: PackedScene,
dust: ColorRect, blurr: ColorRect, envshadows: MeshInstance3D,
thesun: DirectionalLight3D, theenvironment: WorldEnvironment, environmentconfig: EnvironmentConfig,
thecamera: Camera3D, audiostreamplayer: AudioStreamPlayer3D, thundersounds: Array[AudioStream]) -> void:
thecamera: Camera3D, thundersounds: Array[AudioStream], rainsounds: Array[AudioStream]) -> void:
particles_wind = wind
particles_snow = snow
particles_fireflies = fireflies
@@ -59,7 +62,7 @@ func _init(wind: GPUParticles3D, snow: GPUParticles3D,
environment_config = environmentconfig
camera = thecamera
thunder_sounds = thundersounds
audio_player = audiostreamplayer
rain_sounds = rainsounds
set_rain()
@@ -70,15 +73,17 @@ func _init(wind: GPUParticles3D, snow: GPUParticles3D,
set_snow()
set_lightning()
create_sound_players()
func _ready() -> void:
#connect events
UIEvents.toggle_rain.connect(toggle_rain)
UIEvents.toggle_snow.connect(toggle_snow)
UIEvents.toggle_wind.connect(toggle_wind)
UIEvents.toggle_fireflies.connect(toggle_fireflies)
UIEvents.toggle_storm.connect(toggle_storm)
#UIEvents.toggle_fog_overlay.connect(toggle_fog_overlay)
UIEvents.toggle_dust.connect(toggle_dust)
UIEvents.toggle_blur.connect(toggle_blur)
UIEvents.toggle_shadows.connect(toggle_shadows)
@@ -171,11 +176,10 @@ func _process(delta: float) -> void:
#Snow exposure compensation
var snow_light_attenuation = lerp(1.0, 0.55, actual_snow_amount * (1.0 - night_val))
var snow_glow_attenuation = lerp(1.0, 0.5, actual_snow_amount)
var final_bloom = lerp(base_bloom, base_bloom * 0.5, rain_intensity) * snow_glow_attenuation
# We calculate the final exposure by applying snow damping directly to the camera exposure
var final_esposizione = base_exposure * snow_light_attenuation
var final_exposure = base_exposure * snow_light_attenuation
var reflected_color = Color(0.4, 0.5, 0.6, 1.0)
var drops_color = final_sky_horizon.lerp(reflected_color, 0.15)
@@ -203,9 +207,7 @@ func _process(delta: float) -> void:
# Apply glow
environment.environment.glow_enabled = true
environment.environment.glow_intensity = final_bloom
# Make sure the Tonemap Mode in the Environment is set to ACES or Filmic for best results!
environment.environment.tonemap_exposure = final_esposizione
environment.environment.tonemap_exposure = final_exposure
var sky_mat = environment.environment.sky.sky_material as ShaderMaterial
if sky_mat:
@@ -238,6 +240,18 @@ func _follow_camera() -> void:
if particles_fireflies:
particles_fireflies.global_position = Vector3(cam_pos.x, particles_fireflies.position.y, cam_pos.z)
func create_sound_players():
rain_audio_player = AudioStreamPlayer.new()
rain_audio_player.name = "RainAudioPlayer"
rain_audio_player.volume_db = environment_config.rain_audio_volume_db
rain_audio_player.finished.connect(_on_rain_audio_player_finished)
add_child(rain_audio_player)
thunder_audio_player = AudioStreamPlayer.new()
thunder_audio_player.name = "ThunderAudioPlayer"
thunder_audio_player.volume_db = environment_config.thunder_audio_volume_db
add_child(thunder_audio_player)
#region Fireflies
func toggle_fireflies(value: bool):
@@ -400,13 +414,13 @@ func start_lightning():
func _play_thunder_delayed(delay: float):
await get_tree().create_timer(delay).timeout
if thunder_sounds.is_empty() or not audio_player:
if thunder_sounds.is_empty() or not thunder_audio_player:
return
#choose a random track
audio_player.stream = thunder_sounds[randi() % thunder_sounds.size()]
audio_player.pitch_scale = randf_range(0.9, 1.1)
audio_player.play()
thunder_audio_player.stream = thunder_sounds[randi() % thunder_sounds.size()]
thunder_audio_player.pitch_scale = randf_range(0.9, 1.1)
thunder_audio_player.play()
#endregion
#region Rain
@@ -416,6 +430,9 @@ func set_rain():
if particles_rain:
particles_rain.visible = true
particles_rain.emitting = false
if rain_audio_player:
rain_audio_player.volume_db = environment_config.rain_audio_volume_db
rain_audio_player.stop()
RenderingServer.global_shader_parameter_set("global_rain_puddle_amount", 0.0)
func set_puddle_amount(value: float):
@@ -440,11 +457,18 @@ func toggle_rain(value: bool):
if is_raining:
particles_rain.amount_ratio = 0.0
particles_rain.emitting = true
if rain_audio_player:
if not rain_audio_player.playing:
rain_audio_player.volume_db = -80.0
_play_random_rain_sound()
_fade_rain_audio(environment_config.rain_audio_volume_db, false)
rain_tween = create_tween()
rain_tween.tween_property(particles_rain, "amount_ratio", 1.0, environment_config.rain_fade_time)
puddle_tween = create_tween()
puddle_tween.tween_method(set_puddle_amount, puddle_amount, 1.0, environment_config.puddle_form_time)
else:
if rain_audio_player:
_fade_rain_audio(-80.0, true)
rain_tween = create_tween()
rain_tween.tween_property(particles_rain, "amount_ratio", 0.0, environment_config.rain_fade_time)
rain_tween.tween_callback(func():
@@ -481,6 +505,36 @@ func spawn_single_godray() -> void:
godray_tween.tween_property(ray, "scale", Vector3.ZERO, 2.0).set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_SINE)
godray_tween.tween_callback(ray.queue_free)
func _play_random_rain_sound() -> void:
if rain_sounds.is_empty() or rain_audio_player == null:
return
rain_audio_player.stream = rain_sounds[randi() % rain_sounds.size()]
rain_audio_player.pitch_scale = 1.0
rain_audio_player.volume_db = minf(rain_audio_player.volume_db, environment_config.rain_audio_volume_db)
rain_audio_player.play()
func _on_rain_audio_player_finished() -> void:
if is_raining:
_play_random_rain_sound()
func _fade_rain_audio(target_volume_db: float, stop_after_fade: bool) -> void:
if rain_audio_player == null:
return
if rain_audio_tween and rain_audio_tween.is_valid():
rain_audio_tween.kill()
rain_audio_tween = create_tween()
rain_audio_tween.tween_property(
rain_audio_player,
"volume_db",
target_volume_db,
environment_config.rain_fade_time #same value of the rain particles
)
if stop_after_fade:
rain_audio_tween.tween_callback(func(): rain_audio_player.stop())
#endregion
#region Snow

View File

@@ -2,12 +2,21 @@ class_name EnvironmentConfig
extends Resource
@export_group("Day")
@export var start_time: float = 0.0 #start time of the day
@export var day_duration: float = 300.0 #Duration of a full day cycle in seconds
@export var sunrise: float = 0.25 #day_time 1.0→2.0 (night colors → morning colors)
@export var day: float = 0.45 #day_time 2.0→2.0 (stays morning/afternoon)
@export var sunset: float = 0.80 #day_time 2.0→3.0 (afternoon colors → night colors)
@export var night: float = 1.00 #day_time 3.0→3.0 (stays night)
#At wrap 1.0→0.0: day_time stays 3.0, then fades back via sunrise
@export_group("Debug")
@export var show_day_time_debug: bool = true #enable/disable debug on screen (time, normalized time and day_time
#Ambient light color tinting for each time of day
@export_group("Directional Lights and Environment")
@export var morning_color: Color = Color(1.0, 0.9, 0.8, 1.0) #Tint for morning
@export var afternoon_color: Color = Color(1.0, 0.6, 0.2, 1.0) #Tint for afternoon (sunset)
@export var afternoon_color: Color = Color(1.0, 0.663, 0.366, 1.0) #Tint for afternoon (sunset)
@export var night_color: Color = Color(0.1, 0.1, 0.3, 1.0) #Tint for night
#Sun directional light rotation for each time of day
@@ -85,6 +94,7 @@ extends Resource
@export_group("Rain")
@export var rain_mode_color: Color = Color(0.5, 0.6, 0.7, 1.0) #Sky/light darkening color during rain
@export var rain_fade_time: float = 5.0 #Seconds for rain particles to fade in/out
@export var rain_audio_volume_db: float = -10.0 #Target rain loop volume in decibels
@export var puddle_form_time: float = 15.0 #Seconds for puddles to fully form
@export var puddle_dry_time: float = 20.0 #Seconds for puddles to fully dry after rain stops
@@ -104,7 +114,7 @@ extends Resource
@export var lightning_scale_max: float = 3.0 #Maximum random scale of lightning sprite
@export var lightning_texture: String = "res://core/daynight/lighting_albedo.png" # Lightning bolt texture path
@export var weather_event_interval: float = 8.0 #Base interval between weather events
#thunder sound is configured on daynight node
@export var thunder_audio_volume_db: float = 0.0 #Target thunder volume in decibels
#God rays spawned after rain or at morning
@export_group("God Rays")

View File

@@ -25,3 +25,5 @@ signal toggle_shadows(value: bool)
#day cycle signals
@warning_ignore("unused_signal")
signal toggle_pause_daytime(value: bool)
@warning_ignore("unused_signal")
signal day_time_changed(value: float, time_string: String)

View File

@@ -1,5 +1,14 @@
extends Control
@onready var day_night: EnvironmentManagerRoot = get_node_or_null("../DayNight") as EnvironmentManagerRoot
@onready var day_time_label: Label = $DayTimeLabel
@onready var day_time_slider: HSlider = $DayTimeSlider
func _ready() -> void:
UIEvents.day_time_changed.connect(_on_day_time_changed)
_sync_day_time_ui()
func _on_rain_toggled(toggled_on: bool) -> void:
UIEvents.toggle_rain.emit(toggled_on)
@@ -18,6 +27,17 @@ func _on_storm_toggled(toggled_on: bool) -> void:
func _on_day_time_slider_value_changed(value: float) -> void:
UIEvents.set_day_time.emit(value)
func _on_day_time_changed(value: float, time_string: String) -> void:
day_time_slider.set_value_no_signal(value)
var label_text: String = "Time %s" % time_string
if (
day_night != null
and day_night.environment_config != null
and day_night.environment_config.show_day_time_debug
):
label_text = "Time %s | nt %.3f | dt %.3f" % [time_string, value, day_night.day_time]
day_time_label.text = label_text
func _on_fog_overlay_toggled(toggled_on: bool) -> void:
UIEvents.toggle_fog_overlay.emit(toggled_on)
@@ -32,3 +52,19 @@ func _on_pause_toggled(toggled_on: bool) -> void:
func _on_shadows_toggled(toggled_on: bool) -> void:
UIEvents.toggle_shadows.emit(toggled_on)
func _sync_day_time_ui() -> void:
if day_night == null:
return
var day_night_controller: DayNightController = (
day_night.get_node_or_null("DayNightController") as DayNightController
)
if day_night_controller == null:
call_deferred("_sync_day_time_ui")
return
_on_day_time_changed(
day_night_controller.current_time,
day_night_controller.get_time_string()
)

File diff suppressed because one or more lines are too long

BIN
snow.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 KiB

View File

@@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d2sydag8o7r8f"
path="res://.godot/imported/snow.jpg-51a2902860b21a02a582c65a2470860d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://snow.jpg"
dest_files=["res://.godot/imported/snow.jpg-51a2902860b21a02a582c65a2470860d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1