Minor improvement to day-night-visuals

Make sure there's always a little bit of light
This commit is contained in:
karl 2020-01-29 01:50:54 +01:00
parent f07063be0b
commit 5b13164ae9

View File

@ -43,7 +43,7 @@ func _ready():
func _process(_delta):
_currentTime = Daytime.get_time()
_degree = (_currentTime/_max) * 180
_degree = 20 + (_currentTime/_max) * 140
_sun_position()
_light_rotation()
_sky_light()
@ -58,21 +58,21 @@ func _light_rotation():
#set light color depending on daytime
func _sky_light():
var new_light_energy = 0.0
var new_light_energy = 0.2
if _degree <= SUNRISE_DEGREE:
#_worldEnvironment.environment.background_sky.sky_curve = 1
_setSkyColor = SUNRISE
elif _degree > SUNRISE_DEGREE and _degree < RISE_INTERPOL: #interpolate colors from sunrise sky to daytime sky
_setSkyColor = SUNRISE.linear_interpolate(STANDARD_SKY_TOP, ((_degree-SUNRISE_DEGREE)/(RISE_INTERPOL-SUNRISE_DEGREE)))
new_light_energy = inverse_lerp(SUNRISE_DEGREE, RISE_INTERPOL, _degree)
new_light_energy = 0.2 + inverse_lerp(SUNRISE_DEGREE, RISE_INTERPOL, _degree) * 0.8
elif _degree >= RISE_INTERPOL and _degree <= SET_INTERPOL:
#_worldEnvironment.environment.background_sky.sky_curve = 0.09
_setSkyColor = STANDARD_SKY_TOP
new_light_energy = 1.0
elif _degree > SET_INTERPOL and _degree < SUNSET_DEGREE: #interpolate colors from daytime sky to sunset sky
_setSkyColor = STANDARD_SKY_TOP.linear_interpolate(SUNSET, ((_degree-SET_INTERPOL)/(SUNSET_DEGREE-SET_INTERPOL)))
new_light_energy = 1.0 - inverse_lerp(SET_INTERPOL, SUNSET_DEGREE, _degree)
new_light_energy = 0.2 + (1.0 - inverse_lerp(SET_INTERPOL, SUNSET_DEGREE, _degree)) * 0.8
elif _degree >= SUNSET_DEGREE:
_setSkyColor = SUNSET