In Polymost, make r_usenewaspect=2 fog independent of screen x size.

git-svn-id: https://svn.eduke32.com/eduke32@3307 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-12-20 12:04:34 +00:00
parent 192e863dd6
commit 55283e5ce6
3 changed files with 8 additions and 6 deletions

View file

@ -8505,9 +8505,11 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
break; break;
#ifdef USE_OPENGL #ifdef USE_OPENGL
case 3: case 3:
// I have no idea what the significance of this constant is, // NOTE: In Polymost, the fragment depth depends on the x screen size!
// it was found out experimentally. v v if (r_usenewshading==2)
globalvisibility = scale(g_visibility<<2, xdimen, 1100); globalvisibility = scale(g_visibility<<2, xdimen, 1680);
else
globalvisibility = scale(g_visibility<<2, xdimen, 1100);
break; break;
# ifdef POLYMER # ifdef POLYMER
case 4: case 4:

View file

@ -411,7 +411,7 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = {
" fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fragDepth * 1.442695);\n" " fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fragDepth * 1.442695);\n"
#ifdef PR_LINEAR_FOG #ifdef PR_LINEAR_FOG
/* 0.65127==150/230, another constant found out by experiment. :/ /* 0.65127==150/230, another constant found out by experiment. :/
* (150 is Polymost's FOGDISTCONST.) */ * (150 is Polymost's old FOGDISTCONST.) */
" } else {\n" " } else {\n"
" fogFactor = gl_Fog.scale * (gl_Fog.end - fragDepth*0.65217);\n" " fogFactor = gl_Fog.scale * (gl_Fog.end - fragDepth*0.65217);\n"
" fogFactor = clamp(fogFactor, 0.0, 1.0);" " fogFactor = clamp(fogFactor, 0.0, 1.0);"

View file

@ -839,7 +839,7 @@ void polymost_glinit()
extern char nofog; // in windows/SDL layers extern char nofog; // in windows/SDL layers
// For GL_LINEAR fog: // For GL_LINEAR fog:
#define FOGDISTCONST 150 #define FOGDISTCONST 600
#define FULLVIS_BEGIN 2.9e38 #define FULLVIS_BEGIN 2.9e38
#define FULLVIS_END 3.0e38 #define FULLVIS_END 3.0e38
@ -849,7 +849,7 @@ static inline void fogcalc(int32_t shade, int32_t vis, int32_t pal)
if (r_usenewshading==2) if (r_usenewshading==2)
{ {
float combvis = (float)(g_visibility * (uint8_t)(vis+16)); float combvis = (float)globalvisibility * (uint8_t)(vis+16);
bglFogi(GL_FOG_MODE, GL_LINEAR); bglFogi(GL_FOG_MODE, GL_LINEAR);