1
0
Fork 0

Adding ambient support for ac3d aircraft models reveiled a mistake in the scne ambient calculation. Decreasing visibility now increases ambient color giving a nice dark color on bright days and a much more visible color on normal days.

This commit is contained in:
ehofman 2009-03-29 11:41:45 +00:00 committed by Tim Moore
parent b0dd43e022
commit 48ac04456f

View file

@ -234,10 +234,13 @@ void FGLight::update_sky_color () {
gamma_correct_rgb( _cloud_color.data() );
SGVec4f sun_color = thesky->get_sun_color();
float av = thesky->get_visibility();
if (av > 45000) av = 45000;
float avf = ambient+1.0 - log(av)/11.0;
_scene_ambient[0] = ((sun_color[0]*0.25 + _cloud_color[0]*0.75) + ambient) / 2;
_scene_ambient[1] = ((sun_color[1]*0.25 + _cloud_color[1]*0.75) + ambient) / 2;
_scene_ambient[2] = ((sun_color[2]*0.25 + _cloud_color[2]*0.75) + ambient) / 2;
_scene_ambient[0] = sun_color[0] * avf;
_scene_ambient[1] = sun_color[1] * avf;
_scene_ambient[2] = sun_color[2] * avf;
_scene_ambient[3] = 1.0;
_scene_diffuse[0] = (sun_color[0]*0.25 + _fog_color[0]*0.75) * diffuse;