1
0
Fork 0

Add a /rendering/scene/overcast option to color the skydome gray in case of overcast

This commit is contained in:
Erik Hofman 2011-06-05 10:20:16 +02:00
parent a2ddcb8050
commit 8f3cdc9404
2 changed files with 7 additions and 4 deletions

View file

@ -78,6 +78,7 @@ FGLight::FGLight ()
_adj_sky_color(0, 0, 0, 0),
_saturation(1.0),
_scattering(0.8),
_overcast(0.0),
_dt_total(0)
{
}
@ -145,6 +146,7 @@ void FGLight::bind () {
// Write Only
prop->tie("/rendering/scene/saturation",SGRawValuePointer<float>(&_saturation));
prop->tie("/rendering/scene/scattering",SGRawValuePointer<float>(&_scattering));
prop->tie("/rendering/scene/overcast",SGRawValuePointer<float>(&_overcast));
// Read Only
prop->tie("/sim/time/sun-angle-rad",SGRawValuePointer<double>(&_sun_angle));
@ -178,7 +180,7 @@ void FGLight::unbind () {
SGPropertyNode *prop = globals->get_props();
prop->untie("/rendering/scene/saturation");
prop->untie("/rendering/scene/scattering");
prop->untie("/environment/relative-humidity");
prop->untie("/rendering/scene/overcast");
prop->untie("/sim/time/sun-angle-rad");
prop->untie("/rendering/scene/ambient/red");
@ -261,9 +263,9 @@ void FGLight::update_sky_color () {
gamma_correct_rgb( _fog_color.data() );
// set sky color
_sky_color[0] = base_sky_color[0] * sky_brightness;
_sky_color[1] = base_sky_color[1] * sky_brightness;
_sky_color[2] = base_sky_color[2] * sky_brightness;
_sky_color[0] = (base_sky_color[0] + (1.0f-base_sky_color[0]) * _overcast) * sky_brightness;
_sky_color[1] = (base_sky_color[1] + (1.0f-base_sky_color[1]) * _overcast) * sky_brightness;
_sky_color[2] = (base_sky_color[2] + (1.0f-base_sky_color[2]) * _overcast) * sky_brightness;
_sky_color[3] = base_sky_color[3];
gamma_correct_rgb( _sky_color.data() );

View file

@ -100,6 +100,7 @@ private:
// input parameters affected by the weather system
float _saturation;
float _scattering;
float _overcast;
double _dt_total;