From: ehofman Date: Wed, 18 Feb 2004 14:33:16 +0000 (+0000) Subject: Changes to tke sky dome coloring X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=16ad232e0ddca8800db18a6c1daf738c06931d3c;p=simgear.git Changes to tke sky dome coloring --- diff --git a/simgear/scene/sky/dome.cxx b/simgear/scene/sky/dome.cxx index 4048409e..4084c09b 100644 --- a/simgear/scene/sky/dome.cxx +++ b/simgear/scene/sky/dome.cxx @@ -337,24 +337,23 @@ bool SGSkyDome::repaint( sgVec4 sky_color, sgVec4 fog_color, double sun_angle, if (cvf > 45000) cvf = 45000; - if ( vis < 3000.0 ) { - vis_factor = (vis - 1000.0) / 2000.0; - if ( vis_factor < 0.0 ) { - vis_factor = 0.0; - } - } else { - vis_factor = 1.0; + vis_factor = (vis - 1000.0) / 2000.0; + if ( vis_factor < 0.0 ) { + vis_factor = 0.0; + } else if ( vis_factor > 1.0) { + vis_factor = 1.0; } for ( j = 0; j < 3; j++ ) { diff = sky_color[j] - fog_color[j]; - center_color[j] = sky_color[j] - diff * ( 1.0 - vis_factor ); + center_color[j] = sky_color[j]; // - diff * ( 1.0 - vis_factor ); } center_color[3] = 1.0; for ( i = 0; i < 6; i++ ) { for ( j = 0; j < 3; j++ ) { - diff = sky_color[j] - fog_color[j]; + double saif = sun_angle/SG_PI; + diff = (sky_color[j] - fog_color[j]) * (0.8 + j * 0.2) * (0.8 + saif - ((6-i)/10)); // printf("sky = %.2f fog = %.2f diff = %.2f\n", // l->sky_color[j], l->fog_color[j], diff); @@ -397,7 +396,8 @@ bool SGSkyDome::repaint( sgVec4 sky_color, sgVec4 fog_color, double sun_angle, for ( i = 6; i < 12; i++ ) { for ( j = 0; j < 3; j++ ) { - diff = sky_color[j] - fog_color[j]; + double saif = sun_angle/SG_PI; + diff = (sky_color[j] - fog_color[j]) * (0.8 + j * 0.2) * (0.8 + saif - ((-i+12)/10)); // printf("sky = %.2f fog = %.2f diff = %.2f\n", // sky_color[j], fog_color[j], diff); diff --git a/simgear/scene/sky/oursun.cxx b/simgear/scene/sky/oursun.cxx index 9d4794a4..2458736e 100644 --- a/simgear/scene/sky/oursun.cxx +++ b/simgear/scene/sky/oursun.cxx @@ -341,11 +341,18 @@ bool SGSun::repaint( double sun_angle, double new_visibility ) { if (prev_sun_angle != sun_angle) { prev_sun_angle = sun_angle; - float sun_factor = 4*cos(sun_angle); + double vis_factor = (new_visibility - 5000.0) / 10000.0; + if ( vis_factor < 0.0 ) { + vis_factor = 0.0; + } else if ( vis_factor > 1.0) { + vis_factor = 1.0; + } + + float sun_factor = 4 * (cos(sun_angle) + cos(sun_angle)/2) * vis_factor; if (sun_factor > 1) sun_factor = 1.0; if (sun_factor < -1) sun_factor = -1.0; - sun_factor = sun_factor/2 + 0.5; + sun_factor = (sun_factor/2) + 0.5; sgVec4 color; color[1] = sqrt(sun_factor);