add snow management for materials
This commit is contained in:
@@ -29,6 +29,11 @@ var day_time: float = 0.0
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
#set noise texture 2d to materials in special group
|
||||
ApplyWindNoiseToMaterials()
|
||||
#set snow shader to materials in special group
|
||||
ApplySnowShaderToMaterials()
|
||||
|
||||
if day_night_controller == null:
|
||||
day_night_controller = DayNightController.new(
|
||||
environment_config
|
||||
@@ -56,6 +61,24 @@ func _ready() -> void:
|
||||
weather_controller.name = "WeatherController"
|
||||
add_child(weather_controller)
|
||||
|
||||
func ApplyWindNoiseToMaterials():
|
||||
var noise_tex = preload("res://core/daynight/noise.tres")
|
||||
for node in get_tree().get_nodes_in_group("wind_materials"):
|
||||
if node is GeometryInstance3D:
|
||||
node.material_override.set_shader_parameter("wind_noise", noise_tex)
|
||||
|
||||
func ApplySnowShaderToMaterials():
|
||||
var snow_shader = preload("res://core/daynight/snow_overlay.tres")
|
||||
|
||||
#apply to node and childs
|
||||
for node in get_tree().get_nodes_in_group("snow_materials"):
|
||||
if node is GeometryInstance3D:
|
||||
node.material_overlay = snow_shader
|
||||
else:
|
||||
for child in node.get_children():
|
||||
if child is GeometryInstance3D:
|
||||
child.material_overlay = snow_shader
|
||||
|
||||
func select_day_time(normalized_time: float) -> void:
|
||||
# 0.0→0.25 = alba: day_time 1.0→2.0 (night colors → morning colors)
|
||||
# 0.25→0.5 = giorno: day_time 2.0→2.0 (stays morning/afternoon)
|
||||
|
||||
Reference in New Issue
Block a user