16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-20 06:49:19 +02:00

fog color calculation fix

This commit is contained in:
tmj-fstate
2018-02-21 23:13:06 +01:00
parent 40e77acb69
commit da9b1431ea
5 changed files with 51 additions and 16 deletions

View File

@@ -1587,7 +1587,8 @@ TWorld::Update_UI() {
Acc = ( vehicle->MoverParameters->Vel - VelPrev ) / 3.6;
VelPrev = vehicle->MoverParameters->Vel;
}
uitextline2 += ( "; As=" ) + to_string( Acc, 2 ); // przyspieszenie wzdłużne
uitextline2 += "; As=" + to_string( Acc, 2 ); // przyspieszenie wzdłużne
uitextline2 += " eAngle=" + to_string( std::cos( vehicle->MoverParameters->eAngle ), 2 );
uitextline3 =
"cyl.ham. " + to_string( vehicle->MoverParameters->BrakePress, 2 )
@@ -2214,17 +2215,16 @@ world_environment::update() {
// tonal impact of skydome color is inversely proportional to how high the sun is above the horizon
// (this is pure conjecture, aimed more to 'look right' than be accurate)
float const ambienttone = clamp( 1.0f - ( Global.SunAngle / 90.0f ), 0.0f, 1.0f );
Global.DayLight.ambient[ 0 ] = interpolate( skydomehsv.z, skydomecolour.x, ambienttone );
Global.DayLight.ambient[ 1 ] = interpolate( skydomehsv.z, skydomecolour.y, ambienttone );
Global.DayLight.ambient[ 2 ] = interpolate( skydomehsv.z, skydomecolour.z, ambienttone );
Global.DayLight.ambient[ 0 ] = interpolate( skydomehsv.z, skydomecolour.r, ambienttone );
Global.DayLight.ambient[ 1 ] = interpolate( skydomehsv.z, skydomecolour.g, ambienttone );
Global.DayLight.ambient[ 2 ] = interpolate( skydomehsv.z, skydomecolour.b, ambienttone );
Global.fLuminance = intensity;
// update the fog. setting it to match the average colour of the sky dome is cheap
// but quite effective way to make the distant items blend with background better
Global.FogColor[ 0 ] = skydomecolour.x;
Global.FogColor[ 1 ] = skydomecolour.y;
Global.FogColor[ 2 ] = skydomecolour.z;
// NOTE: base brightness calculation provides scaled up value, so we bring it back to 'real' one here
Global.FogColor = m_skydome.GetAverageHorizonColor();
}
void