16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 03:09:18 +02:00

build 190103. configurable reflections refresh rate, resolution based point light size, ai master controller logic enhancement, minor event diagnostic enhancement, minor bug fixes

This commit is contained in:
tmj-fstate
2019-01-03 20:40:45 +01:00
parent bdbbaafc83
commit b53ac3bf10
10 changed files with 59 additions and 86 deletions

View File

@@ -789,9 +789,15 @@ opengl_renderer::Render_pass( rendermode const Mode ) {
bool
opengl_renderer::Render_reflections() {
if( Global.ReflectionUpdatesPerSecond == 0 ) { return false; }
auto const &time = simulation::Time.data();
auto const timestamp = time.wDay * 24 * 60 + time.wHour * 60 + time.wMinute;
if( ( timestamp - m_environmentupdatetime < 5 )
auto const timestamp =
time.wMilliseconds
+ time.wSecond * 1000
+ time.wMinute * 1000 * 60
+ time.wHour * 1000 * 60 * 60;
if( ( timestamp - m_environmentupdatetime < Global.ReflectionUpdatesPerSecond )
&& ( glm::length( m_renderpass.camera.position() - m_environmentupdatelocation ) < 1000.0 ) ) {
// run update every 5+ mins of simulation time, or at least 1km from the last location
return false;
@@ -2578,6 +2584,7 @@ opengl_renderer::Render( TSubModel *Submodel ) {
// we're capping how much effect the distance attenuation can have, otherwise the lights get too tiny at regular distances
float const distancefactor { std::max( 0.5f, ( Submodel->fSquareMaxDist - TSubModel::fSquareDist ) / Submodel->fSquareMaxDist ) };
auto const pointsize { std::max( 3.f, 5.f * distancefactor * anglefactor ) };
auto const resolutionratio { Global.iWindowHeight / 1080.f };
// additionally reduce light strength for farther sources in rain or snow
if( Global.Overcast > 0.75f ) {
float const precipitationfactor{
@@ -2621,7 +2628,7 @@ opengl_renderer::Render( TSubModel *Submodel ) {
clamp<float>( Global.fFogEnd / 2000, 0.f, 1.f ) )
* std::max( 1.f, Global.Overcast ) };
::glPointSize( pointsize * fogfactor );
::glPointSize( pointsize * resolutionratio * fogfactor );
::glColor4f(
lightcolor[ 0 ],
lightcolor[ 1 ],
@@ -2631,7 +2638,7 @@ opengl_renderer::Render( TSubModel *Submodel ) {
m_geometry.draw( Submodel->m_geometry );
::glDepthMask( GL_TRUE );
}
::glPointSize( pointsize );
::glPointSize( pointsize * resolutionratio );
::glColor4f(
lightcolor[ 0 ],
lightcolor[ 1 ],