Skip to content

Commit 85b01ea

Browse files
authoredNov 12, 2018
Night sky: Fix brightness threshold for applying night colours (#7859)
Previously, 'time_brightness' never fell below the threshold so night sky colours were not applied. Increase the threshold value. But now also set it to a value less sensitive to possible future small changes in 'time_brightness', by setting it halfway between the 'time_brightness' values for darkest night and first stage of dawn.
1 parent 98ee089 commit 85b01ea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎src/sky.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -610,22 +610,22 @@ void Sky::update(float time_of_day, float time_brightness,
610610
}
611611

612612
m_clouds_visible = true;
613-
float color_change_fraction = 0.98;
613+
float color_change_fraction = 0.98f;
614614
if (sunlight_seen) {
615-
if (is_dawn) { // Dawn
615+
if (is_dawn) { // Dawn
616616
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
617617
bgcolor_bright_dawn_f, color_change_fraction);
618618
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(
619619
skycolor_bright_dawn_f, color_change_fraction);
620620
m_cloudcolor_bright_f = m_cloudcolor_bright_f.getInterpolated(
621621
cloudcolor_bright_dawn_f, color_change_fraction);
622622
} else {
623-
if (time_brightness < 0.07) { // Night
623+
if (time_brightness < 0.13f) { // Night
624624
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
625625
bgcolor_bright_night_f, color_change_fraction);
626626
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(
627627
skycolor_bright_night_f, color_change_fraction);
628-
} else { // Day
628+
} else { // Day
629629
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
630630
bgcolor_bright_normal_f, color_change_fraction);
631631
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(

0 commit comments

Comments
 (0)
Please sign in to comment.