feat(M03): add environment snapshot facade

This commit is contained in:
2026-07-16 01:00:19 +04:00
parent 60f1e363c0
commit 2ee647a220
12 changed files with 270 additions and 18 deletions
@@ -0,0 +1,40 @@
class_name WorldEnvironmentSnapshot
extends RefCounted
## Immutable renderer input describing the authoritative time within one world day.
## DBC light, area, fog and skybox selection remain owned by the sky controller.
const HOURS_PER_DAY := 24.0
const SCRIPT_PATH := "res://src/render/environment/world_environment_snapshot.gd"
var is_valid: bool:
get:
return _is_valid
var time_of_day_hours: float:
get:
return _time_of_day_hours
var failure_code: StringName:
get:
return _failure_code
var _is_valid: bool
var _time_of_day_hours: float
var _failure_code: StringName
## Creates a snapshot and normalizes finite input into the half-open [0, 24) day.
## Non-finite input produces an explicit invalid value instead of renderer state.
static func at_time_of_day(time_of_day_hours_value: float) -> RefCounted:
return load(SCRIPT_PATH).new(time_of_day_hours_value)
func _init(time_of_day_hours_value: float) -> void:
_is_valid = is_finite(time_of_day_hours_value)
_time_of_day_hours = (
fposmod(time_of_day_hours_value, HOURS_PER_DAY)
if _is_valid
else 0.0
)
_failure_code = &"" if _is_valid else &"environment_time_not_finite"
@@ -0,0 +1 @@
uid://dass4mi3ex2fu