]> git.mxchange.org Git - flightgear.git/commitdiff
Adding ambient support for ac3d aircraft models reveiled a mistake in the scne ambien...
authorehofman <ehofman>
Sun, 29 Mar 2009 11:41:45 +0000 (11:41 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 1 Apr 2009 07:23:55 +0000 (09:23 +0200)
src/Time/light.cxx

index 800ddf687e2f1f703c589654d7a2a350ad644c17..ea55568ae382752f0a71f5f397dddf7a2df93ae9 100644 (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;