add fog and effects
This commit is contained in:
@@ -75,9 +75,10 @@ func _process(delta: float) -> void:
|
||||
var base_grad_intensity: float
|
||||
var base_rotation_sun: Vector3
|
||||
|
||||
var storm_is_active = is_raining and is_snowing
|
||||
|
||||
if storm_is_active:
|
||||
var is_storm = is_raining and is_snowing
|
||||
var is_night = day_time >= 2.5
|
||||
|
||||
if is_storm:
|
||||
rain_intensity = move_toward(rain_intensity, 1.0, delta * 0.5)
|
||||
if is_raining:
|
||||
timer_next_lightning -= delta
|
||||
@@ -155,10 +156,10 @@ func _process(delta: float) -> void:
|
||||
if sun:
|
||||
sun.light_color = final_tint
|
||||
sun.rotation_degrees = base_rotation_sun
|
||||
#var target_energy = lerp(1.0, night_light_energy, night_val)
|
||||
var target_energy = lerp(1.0, environment_config.night_light_energy, night_val)
|
||||
|
||||
# Sunlight scales normally based on weather/night (global exposure does the rest of the work)
|
||||
#sun.light_energy = lerp(target_energy, target_energy * 0.4, rain_intensity)
|
||||
# Sunlight scales based on weather/night
|
||||
sun.light_energy = lerp(target_energy, target_energy * 0.4, rain_intensity)
|
||||
|
||||
if environment and environment.environment:
|
||||
environment.environment.ambient_light_color = final_tint
|
||||
@@ -185,21 +186,14 @@ func _process(delta: float) -> void:
|
||||
if environment_config.material_fog:
|
||||
environment_config.material_fog.set_shader_parameter("night_intensity", night_val)
|
||||
environment_config.material_fog.set_shader_parameter("sun_color", final_tint)
|
||||
|
||||
var e_night = day_time >= 2.5
|
||||
|
||||
#if nodo_polvere:
|
||||
#nodo_polvere.visible = (not storm_is_active and not e_night)
|
||||
|
||||
if particles_fireflies:
|
||||
particles_fireflies.emitting = (not storm_is_active and e_night and thereare_fireflies)
|
||||
|
||||
if particles_wind:
|
||||
particles_wind.emitting = (not storm_is_active and not e_night and is_windy)
|
||||
|
||||
#region fireflies
|
||||
|
||||
func toggle_fireflies(value: bool):
|
||||
thereare_fireflies = value
|
||||
if particles_fireflies:
|
||||
particles_fireflies.emitting = thereare_fireflies
|
||||
|
||||
#disable fireflies and set default values and materials
|
||||
func set_fireflies():
|
||||
@@ -210,11 +204,18 @@ func set_fireflies():
|
||||
var proc_mat = particles_fireflies.process_material as ParticleProcessMaterial
|
||||
if proc_mat:
|
||||
proc_mat.emission_box_extents = Vector3(environment_config.fireflies_spawn_ray, environment_config.fireflies_spawn_height, environment_config.fireflies_spawn_ray)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Wind
|
||||
|
||||
func toggle_wind(value: bool):
|
||||
is_windy = value
|
||||
var is_storm = is_raining and is_snowing
|
||||
var is_night = day_time >= 2.5
|
||||
|
||||
if particles_wind:
|
||||
particles_wind.emitting = (not is_storm and not is_night and is_windy)
|
||||
|
||||
#disable wind and set default values and materials
|
||||
func set_wind():
|
||||
@@ -225,6 +226,7 @@ func set_wind():
|
||||
var proc_mat_wind = particles_wind.process_material as ParticleProcessMaterial
|
||||
if proc_mat_wind:
|
||||
proc_mat_wind.emission_box_extents = Vector3(environment_config.wind_spawn_ray, environment_config.wind_spawn_height, environment_config.wind_spawn_ray)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Lightning
|
||||
@@ -423,30 +425,3 @@ func set_snow_amount(value: float):
|
||||
RenderingServer.global_shader_parameter_set("global_snow_amount", value)
|
||||
|
||||
#endregion
|
||||
|
||||
#func _genera_evento_meteo_casuale() -> void:
|
||||
#sto_cambiando_in_cinematic = true
|
||||
#
|
||||
#var scelta = randi() % 3
|
||||
#
|
||||
#if scelta == 0:
|
||||
#var nuovo_orario = randi() % 3
|
||||
#if menu_giornata:
|
||||
#menu_giornata.selected = nuovo_orario
|
||||
#_on_giornata_selezionata(nuovo_orario)
|
||||
#
|
||||
#elif scelta == 1:
|
||||
#if not is_snowing:
|
||||
#var piove = randf() > 0.5
|
||||
#if bottone_pioggia:
|
||||
#bottone_pioggia.set_pressed_no_signal(piove)
|
||||
#_on_pioggia_toggled(piove)
|
||||
#
|
||||
#elif scelta == 2:
|
||||
#if not is_snowing:
|
||||
#if not is_raining:
|
||||
#if bottone_pioggia:
|
||||
#bottone_pioggia.set_pressed_no_signal(true)
|
||||
#_on_pioggia_toggled(true)
|
||||
#_scatena_fulmine()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user