From b5da5ade72ffd7662dec70c14c8a82ed51f64a0c Mon Sep 17 00:00:00 2001 From: tmj-fstate Date: Tue, 9 Apr 2019 00:34:28 +0200 Subject: [PATCH] additional timetable data for python scripts, light level application fix --- mtable.cpp | 2 ++ renderer.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mtable.cpp b/mtable.cpp index 01b01259..6aed55d0 100644 --- a/mtable.cpp +++ b/mtable.cpp @@ -532,6 +532,8 @@ void TTrainParameters::serialize( dictionary_source *Output ) const { Output->insert( "train_enginetype", LocSeries ); Output->insert( "train_engineload", LocLoad ); + Output->insert( "train_stationfrom", Relation1 ); + Output->insert( "train_stationto", Relation2 ); Output->insert( "train_stationindex", StationIndex ); Output->insert( "train_stationcount", StationCount ); if( StationCount > 0 ) { diff --git a/renderer.cpp b/renderer.cpp index ce8da5f6..1840192d 100644 --- a/renderer.cpp +++ b/renderer.cpp @@ -32,17 +32,18 @@ int const EU07_ENVIRONMENTBUFFERSIZE { 256 }; // size of (square) environmental void opengl_light::apply_intensity( float const Factor ) { - if( Factor == 1.0 ) { + if( Factor == 1.f ) { ::glLightfv( id, GL_AMBIENT, glm::value_ptr( ambient ) ); ::glLightfv( id, GL_DIFFUSE, glm::value_ptr( diffuse ) ); ::glLightfv( id, GL_SPECULAR, glm::value_ptr( specular ) ); } else { + auto const factor{ clamp( Factor, 0.05f, 1.f ) }; // temporary light scaling mechanics (ultimately this work will be left to the shaders - glm::vec4 scaledambient( ambient.r * Factor, ambient.g * Factor, ambient.b * Factor, ambient.a ); - glm::vec4 scaleddiffuse( diffuse.r * Factor, diffuse.g * Factor, diffuse.b * Factor, diffuse.a ); - glm::vec4 scaledspecular( specular.r * Factor, specular.g * Factor, specular.b * Factor, specular.a ); + glm::vec4 scaledambient( ambient.r * factor, ambient.g * factor, ambient.b * factor, ambient.a ); + glm::vec4 scaleddiffuse( diffuse.r * factor, diffuse.g * factor, diffuse.b * factor, diffuse.a ); + glm::vec4 scaledspecular( specular.r * factor, specular.g * factor, specular.b * factor, specular.a ); glLightfv( id, GL_AMBIENT, glm::value_ptr( scaledambient ) ); glLightfv( id, GL_DIFFUSE, glm::value_ptr( scaleddiffuse ) ); glLightfv( id, GL_SPECULAR, glm::value_ptr( scaledspecular ) );