]> git.mxchange.org Git - flightgear.git/commitdiff
Also adjust diffuse based on visibility although probably nobody will notice the...
authorehofman <ehofman>
Thu, 9 Apr 2009 10:42:32 +0000 (10:42 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 15 Apr 2009 21:19:29 +0000 (23:19 +0200)
src/Time/light.cxx

index 4e23980616f4b52842d9f028b8e348fdecb1c5da..046fd8bddf465bc2323884d77afd8aae9c45949b 100644 (file)
@@ -245,9 +245,11 @@ void FGLight::update_sky_color () {
     gamma_correct_rgb( _scene_ambient.data() );
 
     SGVec4f sun_color = thesky->get_sun_color();
-    _scene_diffuse[0] = (sun_color[0]*0.4 + _fog_color[0]*0.6) * diffuse;
-    _scene_diffuse[1] = (sun_color[1]*0.4 + _fog_color[1]*0.6) * diffuse;
-    _scene_diffuse[2] = (sun_color[2]*0.4 + _fog_color[2]*0.6) * diffuse;
+    float ndiff = (ambient + specular) / 2;
+    float idiff = 1.0 - ndiff;
+    _scene_diffuse[0] = (sun_color[0]*ndiff + _fog_color[0]*idiff) * diffuse;
+    _scene_diffuse[1] = (sun_color[1]*ndiff + _fog_color[1]*idiff) * diffuse;
+    _scene_diffuse[2] = (sun_color[2]*ndiff + _fog_color[2]*idiff) * diffuse;
     _scene_diffuse[3] = 1.0;
     gamma_correct_rgb( _scene_diffuse.data() );