Merge pull request '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' (#28) from matt_req_fix into main
Reviewed-on: #28
This commit was merged in pull request #28.
This commit is contained in:
@@ -264,8 +264,8 @@ func _input(event: InputEvent) -> void:
|
||||
if event is InputEventKey and event.pressed and not event.echo:
|
||||
if event.keycode == KEY_T:
|
||||
_goto_next_stop()
|
||||
elif event.keycode == KEY_F:
|
||||
_test_manual_fireworks()
|
||||
#elif event.keycode == KEY_F:
|
||||
#_test_manual_fireworks()
|
||||
|
||||
func _test_manual_fireworks() -> void:
|
||||
if fireworks_scene == null or train_instance == null: return
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
[ext_resource type="PackedScene" uid="uid://fi6faw7ag1i0" path="res://tgcc/chunk/railway/scene/chunk_railway_curve_3.tscn" id="8_r0882"]
|
||||
[ext_resource type="PackedScene" uid="uid://dglpoh63x2lpy" path="res://tgcc/chunk/railway/scene/chunk_railway_curve_4.tscn" id="9_3auto"]
|
||||
[ext_resource type="Script" uid="uid://c374rv220mvh1" path="res://core/biome_generator/railway_pool.gd" id="9_8tdc7"]
|
||||
[ext_resource type="PackedScene" uid="uid://bup6gwlxos0w2" path="res://tgcc/chunk/railway/hero/chunk_railway_station_hero.tscn" id="10_3auto"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("9_8tdc7")
|
||||
name = "Railway Pool"
|
||||
available_railways = Array[PackedScene]([ExtResource("1_86h1y"), ExtResource("3_3auto"), ExtResource("4_i1umq"), ExtResource("5_x44at"), ExtResource("6_vrrkw"), ExtResource("7_l17bw"), ExtResource("8_qcl5o"), ExtResource("8_r0882"), ExtResource("9_3auto")])
|
||||
available_railways = Array[PackedScene]([ExtResource("1_86h1y"), ExtResource("3_3auto"), ExtResource("4_i1umq"), ExtResource("5_x44at"), ExtResource("6_vrrkw"), ExtResource("7_l17bw"), ExtResource("8_qcl5o"), ExtResource("8_r0882"), ExtResource("9_3auto"), ExtResource("10_3auto")])
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -33,6 +33,24 @@ extends Resource
|
||||
@export var exposure_afternoon: float = 0.95
|
||||
@export var exposure_night: float = 0.4
|
||||
|
||||
#Camera tonemap exposure and light tint used only while rain is active
|
||||
@export_group("Rain Exposition and Colors")
|
||||
@export var rain_exposure_morning: float = 0.8
|
||||
@export var rain_exposure_afternoon: float = 0.7
|
||||
@export var rain_exposure_night: float = 0.35
|
||||
@export var rain_morning_color: Color = Color(0.85, 0.89, 0.93, 1.0)
|
||||
@export var rain_afternoon_color: Color = Color(0.78, 0.83, 0.89, 1.0)
|
||||
@export var rain_night_color: Color = Color(0.55, 0.6, 0.75, 1.0)
|
||||
|
||||
#Camera tonemap exposure and light tint used only while storm is active
|
||||
@export_group("Storm Exposition and Colors")
|
||||
@export var storm_exposure_morning: float = 0.65
|
||||
@export var storm_exposure_afternoon: float = 0.55
|
||||
@export var storm_exposure_night: float = 0.25
|
||||
@export var storm_morning_color: Color = Color(0.78, 0.83, 0.89, 1.0)
|
||||
@export var storm_afternoon_color: Color = Color(0.65, 0.7, 0.78, 1.0)
|
||||
@export var storm_night_color: Color = Color(0.45, 0.5, 0.65, 1.0)
|
||||
|
||||
#Sky top color for each time of day
|
||||
@export_group("Sky Colors - Top")
|
||||
@export var sky_top_morning: Color = Color(0.35, 0.65, 0.9, 1.0)
|
||||
|
||||
@@ -8,8 +8,6 @@ extends Button
|
||||
if is_inside_tree() and has_node("%Texture"):
|
||||
$%Texture.texture = image
|
||||
|
||||
|
||||
|
||||
func _ready():
|
||||
if image != null and has_node("%Texture"):
|
||||
$%Texture.texture = image
|
||||
@@ -20,8 +18,6 @@ func _ready():
|
||||
$%TextureRect.hide()
|
||||
TweenFX.breathe(self, 1)
|
||||
|
||||
|
||||
|
||||
func _on_pressed() -> void:
|
||||
if TweenFX.is_playing(self, TweenFX.Animations.PRESS_ROTATE):
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user