From 83675c72169b20549b6c86a77b43c46d50e7d6c6 Mon Sep 17 00:00:00 2001 From: ehofman Date: Sun, 16 Aug 2009 19:57:54 +0000 Subject: [PATCH] Changed my mind, the 'scene specular' color is actually the diffuse color and the sun specular color is the scene specular color --- src/Time/light.cxx | 34 ++++++++++++---------------------- src/Time/light.hxx | 1 - 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/Time/light.cxx b/src/Time/light.cxx index 280f1abdd..062cbd641 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -71,7 +71,6 @@ FGLight::FGLight () _scene_ambient(0, 0, 0, 0), _scene_diffuse(0, 0, 0, 0), _scene_specular(0, 0, 0, 0), - _sun_color(1, 1, 1, 1), _sky_color(0, 0, 0, 0), _fog_color(0, 0, 0, 0), _cloud_color(0, 0, 0, 0), @@ -148,9 +147,6 @@ void FGLight::bind () { prop->tie("/rendering/scene/specular/red",SGRawValuePointer(&_scene_specular[0])); prop->tie("/rendering/scene/specular/green",SGRawValuePointer(&_scene_specular[1])); prop->tie("/rendering/scene/specular/blue",SGRawValuePointer(&_scene_specular[2])); - prop->tie("/rendering/dome/sun/red",SGRawValuePointer(&_sun_color[0])); - prop->tie("/rendering/dome/sun/green",SGRawValuePointer(&_sun_color[1])); - prop->tie("/rendering/dome/sun/blue",SGRawValuePointer(&_sun_color[2])); prop->tie("/rendering/dome/sky/red",SGRawValuePointer(&_sky_color[0])); prop->tie("/rendering/dome/sky/green",SGRawValuePointer(&_sky_color[1])); prop->tie("/rendering/dome/sky/blue",SGRawValuePointer(&_sky_color[2])); @@ -264,27 +260,21 @@ void FGLight::update_sky_color () { _scene_ambient[3] = 1.0; gamma_correct_rgb( _scene_ambient.data() ); - SGVec4f sun_color = thesky->get_scene_color(); + SGVec4f color = thesky->get_scene_color(); 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[0] = color[0] * diffuse; + _scene_diffuse[1] = color[1] * diffuse; + _scene_diffuse[2] = color[2] * diffuse; _scene_diffuse[3] = 1.0; gamma_correct_rgb( _scene_diffuse.data() ); - _scene_specular[0] = sun_color[0] * specular; - _scene_specular[1] = sun_color[1] * specular; - _scene_specular[2] = sun_color[2] * specular; + color = thesky->get_sun_color(); + _scene_specular[0] = color[0] * specular; + _scene_specular[1] = color[1] * specular; + _scene_specular[2] = color[2] * specular; _scene_specular[3] = 1.0; gamma_correct_rgb( _scene_specular.data() ); - - sun_color = thesky->get_sun_color(); - _sun_color[0] = sun_color[0]; - _sun_color[1] = sun_color[1]; - _sun_color[2] = sun_color[2]; - _sun_color[3] = sun_color[3]; - gamma_correct_rgb( _sun_color.data() ); } @@ -334,7 +324,7 @@ void FGLight::update_adj_fog_color () { // revert to unmodified values before usign them. // - SGVec4f sun_color = thesky->get_scene_color(); + SGVec4f color = thesky->get_scene_color(); gamma_restore_rgb( _fog_color.data() ); gamma_restore_rgb( _sky_color.data() ); @@ -342,9 +332,9 @@ void FGLight::update_adj_fog_color () { // Calculate the fog color in the direction of the sun for // sunrise/sunset effects. // - float s_red = sun_color[0]*sun_color[0]; - float s_green = sun_color[1]*sun_color[1]; - float s_blue = sun_color[2]; + float s_red = color[0]*color[0]; + float s_green = color[1]*color[1]; + float s_blue = color[2]; // interpolate beween the sunrise/sunset color and the color // at the opposite direction of this effect. Take in account diff --git a/src/Time/light.hxx b/src/Time/light.hxx index de84629b9..ffffa5ab2 100644 --- a/src/Time/light.hxx +++ b/src/Time/light.hxx @@ -90,7 +90,6 @@ private: SGVec4f _scene_specular; // clear sky, fog and cloud color - SGVec4f _sun_color; SGVec4f _sky_color; SGVec4f _fog_color; SGVec4f _cloud_color;