feat: add witnessed knowledge and wind ambience
This commit is contained in:
@@ -40,7 +40,7 @@ var _simulation_node: Node
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_simulation_node = get_tree().get_first_node_in_group("simulation_manager")
|
||||
_find_simulation_node()
|
||||
if _simulation_node == null:
|
||||
elapsed = cycle_duration_seconds * initial_cycle
|
||||
_apply_light_rotation(initial_cycle)
|
||||
@@ -48,8 +48,10 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if _simulation_node == null or not is_instance_valid(_simulation_node):
|
||||
_find_simulation_node()
|
||||
var cycle: float
|
||||
if _simulation_node != null and "clock" in _simulation_node:
|
||||
if _simulation_node != null and "clock" in _simulation_node and _simulation_node.clock != null:
|
||||
cycle = _simulation_node.clock.time_of_day()
|
||||
else:
|
||||
elapsed += _delta
|
||||
@@ -77,18 +79,18 @@ func _apply_environment(cycle: float) -> void:
|
||||
directional_light.light_color = _lerp_color(NIGHT_LIGHT_COLOR, DAY_LIGHT_COLOR, day_factor)
|
||||
directional_light.light_energy = lerpf(NIGHT_LIGHT_ENERGY, DAY_LIGHT_ENERGY, day_factor)
|
||||
|
||||
var sunset_peak := _sunrise_sunset_weight(cycle)
|
||||
if sunset_peak > 0.0:
|
||||
var sunset_color: Color
|
||||
var transition_peak := _sunrise_sunset_weight(cycle)
|
||||
if transition_peak > 0.0:
|
||||
var transition_color: Color
|
||||
if cycle < 0.5:
|
||||
sunset_color = SUNSET_LIGHT_COLOR
|
||||
transition_color = SUNRISE_LIGHT_COLOR
|
||||
else:
|
||||
sunset_color = SUNRISE_LIGHT_COLOR
|
||||
transition_color = SUNSET_LIGHT_COLOR
|
||||
directional_light.light_color = directional_light.light_color.lerp(
|
||||
sunset_color, sunset_peak * 0.85
|
||||
transition_color, transition_peak * 0.85
|
||||
)
|
||||
directional_light.light_energy = maxf(
|
||||
directional_light.light_energy, SUNRISE_SUNSET_ENERGY * sunset_peak
|
||||
directional_light.light_energy, SUNRISE_SUNSET_ENERGY * transition_peak
|
||||
)
|
||||
|
||||
if world_environment == null or world_environment.environment == null:
|
||||
@@ -112,6 +114,10 @@ func _apply_environment(cycle: float) -> void:
|
||||
mat.ground_horizon_color = _lerp_color(NIGHT_GROUND_HORIZON, DAY_GROUND_HORIZON, day_factor)
|
||||
|
||||
|
||||
func _find_simulation_node() -> void:
|
||||
_simulation_node = get_tree().get_first_node_in_group("simulation_manager")
|
||||
|
||||
|
||||
func _day_factor(cycle: float) -> float:
|
||||
if cycle < 0.15:
|
||||
return 0.0
|
||||
|
||||
Reference in New Issue
Block a user