manage color and exposure during rain e storm; remove wind from rice; disable fireflies on rain, snow or storm; remove key for fireworks test; add hero to railway_pool; manage train windows
This commit is contained in:
@@ -123,7 +123,7 @@ func _process(delta: float) -> void:
|
||||
|
||||
var is_night = day_time >= 2.5
|
||||
if particles_fireflies:
|
||||
particles_fireflies.emitting = thereare_fireflies and is_night
|
||||
particles_fireflies.emitting = thereare_fireflies and is_night and not is_raining and not is_snowing and not is_storm
|
||||
|
||||
var base_tint: Color
|
||||
var base_sky_top: Color
|
||||
@@ -190,11 +190,22 @@ func _process(delta: float) -> void:
|
||||
var final_fog_color = base_fog_color.lerp(base_fog_color * weather_color, clamp(rain_intensity, 0.0, 1.0))
|
||||
var final_fog_density = lerp(base_fog_density, base_fog_density * 4.0, clamp(rain_intensity, 0.0, 1.0))
|
||||
var final_water_color = base_water_color.darkened(clamp(environment_config.water_darkening_rain, 0.0, 1.0) * clamp(rain_intensity, 0.0, 1.0))
|
||||
var rain_weather_amount: float = 0.0
|
||||
if is_raining:
|
||||
rain_weather_amount = clamp(rain_intensity, 0.0, 1.0)
|
||||
var storm_weather_amount: float = 0.0
|
||||
if is_raining and is_storm:
|
||||
if environment_config.storm_rain_intensity_multiplier > 1.0:
|
||||
storm_weather_amount = clamp((rain_intensity - 1.0) / (environment_config.storm_rain_intensity_multiplier - 1.0), 0.0, 1.0)
|
||||
else:
|
||||
storm_weather_amount = rain_weather_amount
|
||||
|
||||
final_tint = final_tint.lerp(final_tint * environment_config.snow_mode_color, snow_weather_amount)
|
||||
final_sky_top = final_sky_top.lerp(final_sky_top * environment_config.snow_mode_color, snow_weather_amount)
|
||||
final_sky_horizon = final_sky_horizon.lerp(final_sky_horizon * environment_config.snow_mode_color, snow_weather_amount)
|
||||
final_fog_color = final_fog_color.lerp(final_fog_color * environment_config.snow_mode_color, snow_weather_amount)
|
||||
final_tint = final_tint.lerp(final_tint * _get_rain_day_color(), rain_weather_amount)
|
||||
final_tint = final_tint.lerp(final_tint * _get_storm_day_color(), storm_weather_amount)
|
||||
|
||||
#Shader parameters for global trunk_shader
|
||||
var final_grad_top = base_grad_top.lerp(base_grad_top * weather_color, clamp(rain_intensity, 0.0, 1.0))
|
||||
@@ -214,6 +225,8 @@ func _process(delta: float) -> void:
|
||||
|
||||
# We calculate the final exposure by applying snow damping directly to the camera exposure
|
||||
var final_exposure = base_exposure * snow_light_attenuation
|
||||
final_exposure = lerp(final_exposure, _get_rain_day_exposure(), rain_weather_amount)
|
||||
final_exposure = lerp(final_exposure, _get_storm_day_exposure(), storm_weather_amount)
|
||||
|
||||
var reflected_color = Color(0.4, 0.5, 0.6, 1.0)
|
||||
var drops_color = final_sky_horizon.lerp(reflected_color, 0.15)
|
||||
@@ -293,6 +306,30 @@ func create_sound_players():
|
||||
thunder_audio_player.volume_db = environment_config.thunder_audio_volume_db
|
||||
add_child(thunder_audio_player)
|
||||
|
||||
func _get_rain_day_color() -> Color:
|
||||
if day_time <= 2.0:
|
||||
return environment_config.rain_morning_color.lerp(environment_config.rain_afternoon_color, day_time - 1.0)
|
||||
|
||||
return environment_config.rain_afternoon_color.lerp(environment_config.rain_night_color, day_time - 2.0)
|
||||
|
||||
func _get_storm_day_color() -> Color:
|
||||
if day_time <= 2.0:
|
||||
return environment_config.storm_morning_color.lerp(environment_config.storm_afternoon_color, day_time - 1.0)
|
||||
|
||||
return environment_config.storm_afternoon_color.lerp(environment_config.storm_night_color, day_time - 2.0)
|
||||
|
||||
func _get_rain_day_exposure() -> float:
|
||||
if day_time <= 2.0:
|
||||
return lerp(environment_config.rain_exposure_morning, environment_config.rain_exposure_afternoon, day_time - 1.0)
|
||||
|
||||
return lerp(environment_config.rain_exposure_afternoon, environment_config.rain_exposure_night, day_time - 2.0)
|
||||
|
||||
func _get_storm_day_exposure() -> float:
|
||||
if day_time <= 2.0:
|
||||
return lerp(environment_config.storm_exposure_morning, environment_config.storm_exposure_afternoon, day_time - 1.0)
|
||||
|
||||
return lerp(environment_config.storm_exposure_afternoon, environment_config.storm_exposure_night, day_time - 2.0)
|
||||
|
||||
#region camera
|
||||
func _set_camera(curr_camera: Camera3D):
|
||||
camera = curr_camera
|
||||
@@ -347,7 +384,7 @@ func toggle_fireflies(value: bool):
|
||||
thereare_fireflies = value
|
||||
var is_night = day_time >= 2.5
|
||||
if particles_fireflies:
|
||||
particles_fireflies.emitting = thereare_fireflies and is_night
|
||||
particles_fireflies.emitting = thereare_fireflies and is_night and not is_raining
|
||||
|
||||
#disable fireflies and set default values and materials
|
||||
func init_fireflies():
|
||||
|
||||
Reference in New Issue
Block a user