From e24004b17bea061d2de192c95f017674b345e181 Mon Sep 17 00:00:00 2001 From: ThorstenB <brehmt@gmail.com> Date: Fri, 10 Feb 2012 21:16:39 +0100 Subject: [PATCH] #589: 2D panels transparent at night. May also fix #591. Since d91a617423fa5c269902a847494b3778b05ebcb4 (vectory color calculations) all 4 elements of a color were scaled with the respective brightness. The caused some panels to be transparent at night etc. Before the change, only the 3 RGB elements of the colors were scaled, while the 4th element (alpha channel?) remained unaltered. Commit restores the alpha elements to their original behaviour. => "Quick hack" for 2.6.0. Need s.o. to double check the initial changes and commit something clean to "next". --- src/Time/light.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Time/light.cxx b/src/Time/light.cxx index caeff9d2b..bcd6ebf69 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -244,12 +244,14 @@ void FGLight::update_sky_color () { /** fog color */ float sqr_sky_brightness = sky_brightness * sky_brightness * _scattering; _fog_color = base_fog_color * sqr_sky_brightness; + _fog_color[3] = base_fog_color[3]; gamma_correct_rgb( _fog_color.data() ); /** sky color */ static const SGVec4f one_vec( 1.0f, 1.0f, 1.0f, 1.0f); SGVec4f overcast_color = (one_vec - base_sky_color) * _overcast; _sky_color = (base_sky_color + overcast_color) * sky_brightness; + _sky_color[3] = base_sky_color[3]; gamma_correct_rgb( _sky_color.data() ); /** cloud color */ @@ -260,16 +262,19 @@ void FGLight::update_sky_color () { float sun2 = 1.0 / sqrt(_sun_angle); _cloud_color *= sun2; } + _cloud_color[3] = base_fog_color[3]; gamma_correct_rgb( _cloud_color.data() ); /** ambient light */ _scene_ambient = _fog_color * ambient; + _scene_ambient[3] = _fog_color[3]; gamma_correct_rgb( _scene_ambient.data() ); /** diffuse light */ SGSky* thesky = globals->get_renderer()->getSky(); SGVec4f color = thesky->get_scene_color(); _scene_diffuse = color * diffuse; + _scene_diffuse[3] = color[3]; gamma_correct_rgb( _scene_diffuse.data() ); SGVec4f chrome = _scene_ambient * .4f + _scene_diffuse; @@ -283,6 +288,7 @@ void FGLight::update_sky_color () { /** specular light */ _sun_color = thesky->get_sun_color(); _scene_specular = _sun_color * specular; + _scene_specular[3] = _sun_color[3]; gamma_correct_rgb( _scene_specular.data() ); } @@ -367,6 +373,7 @@ void FGLight::update_adj_fog_color () { gamma = system_gamma * (0.9 - sif*avf); _adj_fog_color = rf3 * _fog_color + rf2 * _sun_color; + _adj_fog_color[3] = 0; gamma_correct_rgb( _adj_fog_color.data(), gamma); // make sure the colors have their original value before they are being