From bbacc9e816c3cce64c204c7cbe4bf8943eed1961 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 3 Jul 2020 17:38:42 +1000 Subject: [PATCH] - factor in xdimenscale and viewingrangerecip when calculating renderSetVisibility(). * Changes performed in 0bd460d9e3bbaf239f4a33f9ce589dff58660bea didn't take into account xdimenscale and viewingrangerecip like the days of old and this wasn't picked up in d80a32d37905e12e57d2c2e86097290dbf236114 or d80a32d37905e12e57d2c2e86097290dbf236114, where the applied fixes only appeared to work because they worked for me at 2560x1440p. --- source/build/include/polymost.h | 1 + source/build/src/engine.cpp | 2 +- source/build/src/polymost.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index b79345cd2..99db0cfd2 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -108,5 +108,6 @@ EDUKE32_STATIC_ASSERT(DAMETH_NARROW_MASKPROPS(DAMETH_MASKPROPS) == DAMETH_MASK); extern float fcosglobalang, fsinglobalang; extern float fxdim, fydim, fydimen, fviewingrange; +extern int32_t viewingrangerecip; #endif diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 05d3f78a5..618088285 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -1104,7 +1104,7 @@ static int32_t globaluclip, globaldclip; //char globparaceilclip, globparaflorclip; int32_t xyaspect; -static int32_t viewingrangerecip; +int32_t viewingrangerecip; static char globalxshift, globalyshift; static int32_t globalxpanning, globalypanning; diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index ac5638519..7ff3c180c 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -266,7 +266,7 @@ static void polymost_updaterotmat(void) }; multiplyMatrix4f(matrix, tiltmatrix); renderSetViewMatrix(matrix); - renderSetVisibility(((float)(g_visibility) / r_ambientlight) * fviewingrange * (7.5f / (65536.f * 65536.f))); + renderSetVisibility(mulscale16(g_visibility, mulscale16(xdimenscale, viewingrangerecip)) * fviewingrange * (1.f / (65536.f * 65536.f)) / r_ambientlight); } static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, int32_t method, const vec2_16_t& tilesiz);