1
0
Fork 0

fog color and cloud color are the same anyhow, remove one of them in the ambient color calculation

This commit is contained in:
ehofman 2009-04-04 09:20:33 +00:00 committed by Tim Moore
parent 846d756e55
commit c2af121c00

View file

@ -217,13 +217,18 @@ void FGLight::update_sky_color () {
_sky_color[3] = base_sky_color[3]; _sky_color[3] = base_sky_color[3];
gamma_correct_rgb( _sky_color.data() ); gamma_correct_rgb( _sky_color.data() );
// set cloud and fog color // set fog and cloud color
_cloud_color[0] = _fog_color[0] = base_fog_color[0] * sky_brightness; _fog_color[0] = base_fog_color[0] * sky_brightness;
_cloud_color[1] = _fog_color[1] = base_fog_color[1] * sky_brightness; _fog_color[1] = base_fog_color[1] * sky_brightness;
_cloud_color[2] = _fog_color[2] = base_fog_color[2] * sky_brightness; _fog_color[2] = base_fog_color[2] * sky_brightness;
_cloud_color[3] = _fog_color[3] = base_fog_color[3]; _fog_color[3] = base_fog_color[3];
gamma_correct_rgb( _fog_color.data() ); gamma_correct_rgb( _fog_color.data() );
_cloud_color[0] = base_fog_color[0] * sky_brightness;
_cloud_color[1] = base_fog_color[1] * sky_brightness;
_cloud_color[2] = base_fog_color[2] * sky_brightness;
_cloud_color[3] = base_fog_color[3];
// adjust the cloud colors for sunrise/sunset effects (darken them) // adjust the cloud colors for sunrise/sunset effects (darken them)
if (_sun_angle > 1.0) { if (_sun_angle > 1.0) {
float sun2 = sqrt(_sun_angle); float sun2 = sqrt(_sun_angle);
@ -233,21 +238,24 @@ void FGLight::update_sky_color () {
} }
gamma_correct_rgb( _cloud_color.data() ); gamma_correct_rgb( _cloud_color.data() );
_scene_ambient[0] = _fog_color[0] * _cloud_color[0] * ambient; _scene_ambient[0] = _fog_color[0] * ambient;
_scene_ambient[1] = _fog_color[1] * _cloud_color[1] * ambient; _scene_ambient[1] = _fog_color[1] * ambient;
_scene_ambient[2] = _fog_color[2] * _cloud_color[2] * ambient; _scene_ambient[2] = _fog_color[2] * ambient;
_scene_ambient[3] = 1.0; _scene_ambient[3] = 1.0;
gamma_correct_rgb( _scene_ambient.data() );
SGVec4f sun_color = thesky->get_sun_color(); SGVec4f sun_color = thesky->get_sun_color();
_scene_diffuse[0] = (sun_color[0]*0.4 + _fog_color[0]*0.6) * diffuse; _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[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; _scene_diffuse[2] = (sun_color[2]*0.4 + _fog_color[2]*0.6) * diffuse;
_scene_diffuse[3] = 1.0; _scene_diffuse[3] = 1.0;
gamma_correct_rgb( _scene_diffuse.data() );
_scene_specular[0] = sun_color[0] * specular; _scene_specular[0] = sun_color[0] * specular;
_scene_specular[1] = sun_color[1] * specular; _scene_specular[1] = sun_color[1] * specular;
_scene_specular[2] = sun_color[2] * specular; _scene_specular[2] = sun_color[2] * specular;
_scene_specular[3] = 1.0; _scene_specular[3] = 1.0;
gamma_correct_rgb( _scene_specular.data() );
} }