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

build 180122. radio channel cab controls, sky brightness calculation fix, motor ventilator spin rate tweaks

This commit is contained in:
tmj-fstate
2018-01-22 18:07:31 +01:00
parent 9abaf7414f
commit 0dc1394d59
15 changed files with 84 additions and 40 deletions

View File

@@ -1453,7 +1453,7 @@ opengl_renderer::Render( world_environment *Environment ) {
GL_LIGHT_MODEL_AMBIENT,
glm::value_ptr(
interpolate( Environment->m_skydome.GetAverageColor(), suncolor, duskfactor * 0.25f )
* ( 1.0f - Global::Overcast * 0.5f ) // overcast darkens the clouds
* interpolate( 1.f, 0.35f, Global::Overcast / 2.f ) // overcast darkens the clouds
* 2.5f // arbitrary adjustment factor
) );
// render
@@ -3135,11 +3135,17 @@ opengl_renderer::Render_Alpha( TSubModel *Submodel ) {
static_cast<float>( TSubModel::fSquareDist / Submodel->fSquareMaxDist ) ); // pozycja punktu świecącego względem kamery
Submodel->fCosViewAngle = glm::dot( glm::normalize( modelview * glm::vec4( 0.f, 0.f, -1.f, 1.f ) - lightcenter ), glm::normalize( -lightcenter ) );
float glarelevel = 0.6f; // luminosity at night is at level of ~0.1, so the overall resulting transparency is ~0.5 at full 'brightness'
float glarelevel = 0.6f; // luminosity at night is at level of ~0.1, so the overall resulting transparency in clear conditions is ~0.5 at full 'brightness'
if( Submodel->fCosViewAngle > Submodel->fCosFalloffAngle ) {
// only bother if the viewer is inside the visibility cone
if( Global::Overcast > 1.0 ) {
// increase the glare in rainy/foggy conditions
glarelevel += std::max( 0.f, 0.5f * ( Global::Overcast - 1.f ) );
}
// scale it down based on view angle
glarelevel *= ( Submodel->fCosViewAngle - Submodel->fCosFalloffAngle ) / ( 1.0f - Submodel->fCosFalloffAngle );
glarelevel = std::max( 0.0f, glarelevel - static_cast<float>(Global::fLuminance) );
// reduce the glare in bright daylight
glarelevel = clamp( glarelevel - static_cast<float>(Global::fLuminance), 0.f, 1.f );
if( glarelevel > 0.0f ) {
// setup