From cd7bbe35a8ed57236e4afd87dfac7296be60c467 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 19 Oct 2019 15:52:46 +0200 Subject: [PATCH] - removed all legacy fog code. --- source/build/include/build.h | 3 - source/build/include/polymost.h | 2 +- source/build/src/common.cpp | 2 - source/build/src/engine_priv.h | 9 -- source/build/src/palette.cpp | 4 +- source/build/src/polymost.cpp | 106 +----------------- source/duke3d/src/screens.cpp | 8 -- source/glbackend/gl_palmanager.cpp | 21 ++++ source/glbackend/gl_renderstate.h | 2 - source/glbackend/gl_shader.cpp | 2 - source/glbackend/gl_shader.h | 2 - source/glbackend/glbackend.cpp | 11 +- source/glbackend/glbackend.h | 9 +- source/rr/src/screens.cpp | 8 -- source/sw/src/anim.cpp | 2 +- .../demolition/shaders/glsl/polymost.fp | 12 -- 16 files changed, 32 insertions(+), 171 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 56fc2e41d..57eca626b 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -1408,9 +1408,6 @@ int32_t engineLoadBoardV5V6(const char *filename, char fromwhere, vec3_t *dapos, #endif -void renderDisableFog(void); -void renderEnableFog(void); - static vec2_t const zerovec = { 0, 0 }; #ifdef LUNATIC diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index f244247ff..4ad5fdc85 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -18,7 +18,7 @@ extern float glox1, gloy1; extern double gxyaspect; extern float grhalfxdown10x; extern float gcosang, gsinang, gcosang2, gsinang2; -extern float gchang, gshang, gctang, gstang, gvisibility; +extern float gchang, gshang, gctang, gstang; extern float gvrcorrection; struct glfiltermodes { diff --git a/source/build/src/common.cpp b/source/build/src/common.cpp index d572d444a..7eec0b298 100644 --- a/source/build/src/common.cpp +++ b/source/build/src/common.cpp @@ -249,7 +249,6 @@ int32_t FindDistance3D(int32_t x, int32_t y, int32_t z) // Clear OSD background void COMMON_doclearbackground(int numcols, int height) { - GLInterface.SetFogEnabled(false); GLInterface.UseColorOnly(true); polymostSet2dView(); @@ -278,7 +277,6 @@ void COMMON_doclearbackground(int numcols, int height) GLInterface.Draw(DT_TRIANGLE_STRIP, vert.first+4, 4); GLInterface.UseColorOnly(false); - GLInterface.SetFogEnabled(true); } void COMMON_clearbackground(int numcols, int numrows) diff --git a/source/build/src/engine_priv.h b/source/build/src/engine_priv.h index 4383a5553..c02ed8425 100644 --- a/source/build/src/engine_priv.h +++ b/source/build/src/engine_priv.h @@ -132,15 +132,6 @@ extern int16_t bunchp2[MAXWALLSB]; extern int16_t numscans, numbunches; extern int32_t rxi[8], ryi[8]; -#ifdef USE_OPENGL - -// For GL_EXP2 fog: -#define FOGSCALE 0.0000768f - -void calc_and_apply_fog(int32_t shade, int32_t vis, int32_t pal); -void calc_and_apply_fog_factor(int32_t shade, int32_t vis, int32_t pal, float factor); -#endif - extern void get_wallspr_points(uspriteptr_t spr, int32_t *x1, int32_t *x2, int32_t *y1, int32_t *y2); extern void get_floorspr_points(uspriteptr_t spr, int32_t px, int32_t py, diff --git a/source/build/src/palette.cpp b/source/build/src/palette.cpp index 17ed88cb2..0ad784c47 100644 --- a/source/build/src/palette.cpp +++ b/source/build/src/palette.cpp @@ -59,7 +59,6 @@ void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f) GLInterface.EnableDepthTest(false); GLInterface.EnableAlphaTest(false); - GLInterface.SetFogEnabled(false); GLInterface.SetBlendFunc(STYLEALPHA_Src, STYLEALPHA_InvSrc); GLInterface.EnableBlend(true); @@ -94,8 +93,7 @@ void fullscreen_tint_gl_blood(void) GLInterface.EnableDepthTest(false); GLInterface.EnableAlphaTest(false); - GLInterface.SetFogEnabled(false); - + GLInterface.SetBlendFunc(STYLEALPHA_One, STYLEALPHA_One); GLInterface.EnableBlend(true); diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 94faa3a5b..7cc9a47c8 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -66,7 +66,7 @@ static float ghorizcorrect; double gxyaspect; float gyxscale, ghalfx, grhalfxdown10, grhalfxdown10x, ghalfy; float gcosang, gsinang, gcosang2, gsinang2; -float gchang, gshang, gctang, gstang, gvisibility; +float gchang, gshang, gctang, gstang; float gtang = 0.f; float gvrcorrection = 1.f; @@ -298,63 +298,6 @@ void polymost_glinit() } } -////////// VISIBILITY FOG ROUTINES ////////// - -// For GL_LINEAR fog: -#define GL_FOG_MAX 1.0e37f - -void calc_and_apply_fog(int32_t shade, int32_t vis, int32_t pal) -{ - if (nofog) return; - - fogresult = 0.f; - fogcol = fogtable[pal]; - - if (((uint8_t)(vis + 16)) > 0 && globalvisibility > 0) - { - constexpr GLfloat glfogconstant = 262144.f; - GLfloat fogrange = (frealmaxshade * glfogconstant) / (((uint8_t)(vis + 16)) * globalvisibility); - - fogresult = 0.f - (((min(shade, 0) - 0.5f) / frealmaxshade) * fogrange); // min() = subtract shades from fog - fogresult2 = fogrange - (((shade - 0.5f) / frealmaxshade) * fogrange); - } - else - { - fogresult = 0.f; - fogresult2 = -GL_FOG_MAX; // hide fog behind the camera - } - - GLInterface.SetFogLinear((float*)&fogcol, fogresult, fogresult2); -} - -void calc_and_apply_fog_factor(int32_t shade, int32_t vis, int32_t pal, float factor) -{ - if (nofog) return; - - fogcol = fogtable[pal]; - - if (((uint8_t)(vis + 16)) > 0 && ((((uint8_t)(vis + 16)) / 8.f) + shade) > 0) - { - GLfloat normalizedshade = (shade - 0.5f) / frealmaxshade; - GLfloat fogrange = (((uint8_t)(vis + 16)) / (8.f * frealmaxshade)) + normalizedshade; - - // subtract shades from fog - if (normalizedshade > 0.f && normalizedshade < 1.f) - fogrange = (fogrange - normalizedshade) / (1.f - normalizedshade); - - fogresult = -(GL_FOG_MAX * fogrange); - fogresult2 = GL_FOG_MAX - (GL_FOG_MAX * fogrange); - } - else - { - fogresult = 0.f; - fogresult2 = -GL_FOG_MAX; // hide fog behind the camera - } - - GLInterface.SetFogLinear((float*)& fogcol, fogresult, fogresult2); -} -//////////////////// - static float get_projhack_ratio(void) { @@ -425,8 +368,6 @@ static void resizeglcheck(void) GLInterface.SetMatrix(Matrix_Projection, &m[0][0]); VSMatrix identity(0); GLInterface.SetMatrix(Matrix_ModelView, &identity); - - if (!nofog) GLInterface.SetFogEnabled(true); } } @@ -1913,8 +1854,6 @@ static void polymost_internal_nonparallaxed(vec2f_t n0, vec2f_t n1, float ryp0, drawpoly_alpha = 0.f; drawpoly_blend = 0; - calc_and_apply_fog(fogshade(global_cf_shade, global_cf_pal), sec->visibility, POLYMOST_CHOOSE_FOG_PAL(global_cf_fogpal, global_cf_pal)); - if (have_floor) { if (globalposz > getflorzofslope(sectnum, globalposx, globalposy)) @@ -2382,8 +2321,6 @@ static void polymost_drawalls(int32_t const bunch) } else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1))) { - calc_and_apply_fog_factor(sec->floorshade, sec->visibility, sec->floorpal, 0.005f); - globvis2 = globalpisibility; if (sec->visibility != 0) globvis2 = mulscale4(globvis2, (uint8_t)(sec->visibility + 16)); @@ -2593,8 +2530,6 @@ static void polymost_drawalls(int32_t const bunch) skyclamphack = 0; skyzbufferhack = 0; - if (!nofog) - GLInterface.SetFogEnabled(true); } // Ceiling @@ -2644,8 +2579,6 @@ static void polymost_drawalls(int32_t const bunch) } else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1))) { - calc_and_apply_fog_factor(sec->ceilingshade, sec->visibility, sec->ceilingpal, 0.005f); - globvis2 = globalpisibility; if (sec->visibility != 0) globvis2 = mulscale4(globvis2, (uint8_t)(sec->visibility + 16)); @@ -2855,8 +2788,6 @@ static void polymost_drawalls(int32_t const bunch) skyclamphack = 0; skyzbufferhack = 0; - if (!nofog) - GLInterface.SetFogEnabled(true); } #ifdef YAX_ENABLE @@ -2960,8 +2891,6 @@ static void polymost_drawalls(int32_t const bunch) } if (wal->cstat&256) { xtex.v = -xtex.v; ytex.v = -ytex.v; otex.v = -otex.v; } //yflip - calc_and_apply_fog(fogshade(wal->shade, wal->pal), sec->visibility, get_floor_fogpal(sec)); - pow2xsplit = 1; #ifdef YAX_ENABLE if (should_clip_cfwall(x1,cy1,x0,cy0)) @@ -3004,8 +2933,6 @@ static void polymost_drawalls(int32_t const bunch) } if (nwal->cstat&256) { xtex.v = -xtex.v; ytex.v = -ytex.v; otex.v = -otex.v; } //yflip - calc_and_apply_fog(fogshade(nwal->shade, nwal->pal), sec->visibility, get_floor_fogpal(sec)); - pow2xsplit = 1; #ifdef YAX_ENABLE if (should_clip_cfwall(x0,fy0,x1,fy1)) @@ -3060,8 +2987,6 @@ static void polymost_drawalls(int32_t const bunch) } if (wal->cstat&256) { xtex.v = -xtex.v; ytex.v = -ytex.v; otex.v = -otex.v; } //yflip - calc_and_apply_fog(fogshade(wal->shade, wal->pal), sec->visibility, get_floor_fogpal(sec)); - pow2xsplit = 1; #ifdef YAX_ENABLE @@ -3407,9 +3332,7 @@ void polymost_drawrooms() ghoriz = fix16_to_float(qglobalhoriz); ghorizcorrect = fix16_to_float((100-polymostcenterhoriz)*divscale16(xdimenscale, viewingrange)); - gvisibility = ((float)globalvisibility)*FOGSCALE; - - GLInterface.SetShadeInterpolate(r_shadeinterpolate); + GLInterface.SetShadeInterpolate(r_shadeinterpolate); //global cos/sin height angle if (r_yshearing) @@ -3745,8 +3668,6 @@ static void polymost_drawmaskwallinternal(int32_t wallIndex) drawpoly_alpha = 0.f; drawpoly_blend = blend; - calc_and_apply_fog(fogshade(wal->shade, wal->pal), sec->visibility, get_floor_fogpal(sec)); - float const csy[4] = { ((float)(cz[0] - globalposz)) * ryp0 + ghoriz, ((float)(cz[1] - globalposz)) * ryp0 + ghoriz, ((float)(cz[2] - globalposz)) * ryp1 + ghoriz, @@ -3875,7 +3796,6 @@ void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fix16_t daang grhalfxdown10 = 1.f/(ghalfx*1024.f); ghoriz = fix16_to_float(qglobalhoriz); ghorizcorrect = fix16_to_float((100-polymostcenterhoriz)*divscale16(xdimenscale, viewingrange)); - gvisibility = ((float)globalvisibility)*FOGSCALE; resizeglcheck(); if (r_yshearing) { @@ -4055,8 +3975,6 @@ void polymost_drawsprite(int32_t snum) sec = (usectorptr_t)§or[tspr->sectnum]; - calc_and_apply_fog(fogshade(globalshade, globalpal), sec->visibility, get_floor_fogpal(sec)); - while (!(spriteext[spritenum].flags & SPREXT_NOTMD)) { if (usemodels && tile2model[Ptile2tile(tspr->picnum, tspr->pal)].modelid >= 0 && @@ -4799,13 +4717,9 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a, spriteext[tspr.owner].alpha = daalpha * (1.0f / 255.0f); tspr.blend = dablend; - GLInterface.SetFogEnabled(false); - if (videoGetRenderMode() == REND_POLYMOST) polymost_mddraw(&tspr); - if (!nofog) GLInterface.SetFogEnabled(true); - gvrcorrection = ogvrcorrection; viewingrange = oldviewingrange; fviewingrange = oldfviewingrange; @@ -5039,9 +4953,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16 xtex.v = yv2*(1.0/65536.0); ytex.v = yv*(1.0/65536.0); - GLInterface.SetFogEnabled(false); pow2xsplit = 0; polymost_drawpoly(fpxy,n,method, tilesiz[globalpicnum]); - if (!nofog) GLInterface.SetFogEnabled(true); } GLInterface.EnableAlphaTest(false); @@ -5331,17 +5243,6 @@ static int32_t gen_font_glyph_tex(void) return 0; } -// These are used by the automap drawers -void renderDisableFog(void) -{ - GLInterface.SetFogEnabled(false); -} - -void renderEnableFog(void) -{ - if (!nofog) GLInterface.SetFogEnabled(true); -} - int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize) { int const arbackcol = (unsigned)backcol < 256 ? backcol : 0; @@ -5368,7 +5269,6 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba GLInterface.EnableAlphaTest(false); GLInterface.SetDepthMask(false); - GLInterface.SetFogEnabled(false); // We want to have readable text in wireframe mode, too: GLInterface.SetWireframe(false); lastglpolygonmode = 0; @@ -5457,8 +5357,6 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba GLInterface.SetDepthMask(true); - if (!nofog) GLInterface.SetFogEnabled(true); - return 0; } diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 5cb770ba0..df2febc61 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -328,8 +328,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 xvect2 = mulscale16(xvect, yxaspect); yvect2 = mulscale16(yvect, yxaspect); - renderDisableFog(); - //Draw red lines for (i=numsectors-1; i>=0; i--) { @@ -368,8 +366,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 } } - renderEnableFog(); - //Draw sprites k = g_player[screenpeek].ps->i; if (!FURY) for (i=numsectors-1; i>=0; i--) @@ -515,8 +511,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 } } - renderDisableFog(); - //Draw white lines for (i=numsectors-1; i>=0; i--) { @@ -557,8 +551,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 } } - renderEnableFog(); - videoSetCorrectedAspect(); for (TRAVERSE_CONNECT(p)) diff --git a/source/glbackend/gl_palmanager.cpp b/source/glbackend/gl_palmanager.cpp index 815e47ff1..fbb286476 100644 --- a/source/glbackend/gl_palmanager.cpp +++ b/source/glbackend/gl_palmanager.cpp @@ -139,6 +139,26 @@ unsigned PaletteManager::FindPalswap(const uint8_t* paldata) pd.lookup = paldata; pd.crc32 = crc32; pd.swaptexture = nullptr; + + // Find what index maps to black (or the darkest available color) + int found = -1; + PalEntry foundColor = 0xffffffff; + for (int i = 0; i < 255; i++) + { + int map = paldata[i]; + PalEntry color = palettes[0].colors[map]; + if (color.Luminance() < foundColor.Luminance()) + { + foundColor = color; + found = i; + } + } + + // Determine the fade color. We pick what black, or the darkest color, maps to in the lowest shade level. + int map = paldata[(numshades - 2) * 256 + found]; // do not look in the latest shade level because it doesn't always contain useful data for this. + pd.fadeColor = palettes[0].colors[map]; + if (pd.fadeColor.Luminance() < 10) pd.fadeColor = 0; // Account for the inability to check the last fade level by using a higher threshold for determining black fog. + return palswaps.Push(pd); } @@ -251,6 +271,7 @@ void PaletteManager::BindPalswap(int index) palswaps[uindex].swaptexture = p; } inst->BindTexture(1, palswaps[uindex].swaptexture); + inst->SetFadeColor(palswaps[index].fadeColor); } } diff --git a/source/glbackend/gl_renderstate.h b/source/glbackend/gl_renderstate.h index a69175af1..2e7c525b4 100644 --- a/source/glbackend/gl_renderstate.h +++ b/source/glbackend/gl_renderstate.h @@ -8,7 +8,6 @@ struct PolymostRenderState float Shade; float NumShades = 64.f; float VisFactor = 128.f; - float FogEnabled = 1.f; float UseColorOnly; float UsePalette = 1.f; float UseDetailMapping; @@ -18,7 +17,6 @@ struct PolymostRenderState float NPOTEmulationXOffset; float Brightness = 1.f; float ShadeInterpolate = 1.f; - float Fog[4]; float FogColor[4]; void Apply(PolymostShader *shader); diff --git a/source/glbackend/gl_shader.cpp b/source/glbackend/gl_shader.cpp index a87955231..bcb06e8a5 100644 --- a/source/glbackend/gl_shader.cpp +++ b/source/glbackend/gl_shader.cpp @@ -139,7 +139,6 @@ bool PolymostShader::Load(const char * name, const char * vert_prog, const char Shade.Init(hShader, "u_shade"); NumShades.Init(hShader, "u_numShades"); VisFactor.Init(hShader, "u_visFactor"); - FogEnabled.Init(hShader, "u_fogEnabled"); UseColorOnly.Init(hShader, "u_useColorOnly"); UsePalette.Init(hShader, "u_usePalette"); UseDetailMapping.Init(hShader, "u_useDetailMapping"); @@ -149,7 +148,6 @@ bool PolymostShader::Load(const char * name, const char * vert_prog, const char NPOTEmulationXOffset.Init(hShader, "u_npotEmulationXOffset"); Brightness.Init(hShader, "u_brightness"); ShadeInterpolate.Init(hShader, "u_shadeInterpolate"); - Fog.Init(hShader, "u_fog"); FogColor.Init(hShader, "u_fogColor"); RotMatrix.Init(hShader, "u_rotMatrix"); diff --git a/source/glbackend/gl_shader.h b/source/glbackend/gl_shader.h index 30863a9c8..fadc13d86 100644 --- a/source/glbackend/gl_shader.h +++ b/source/glbackend/gl_shader.h @@ -39,7 +39,6 @@ public: FBufferedUniform1f Shade; FBufferedUniform1f NumShades; FBufferedUniform1f VisFactor; - FBufferedUniform1f FogEnabled; FBufferedUniform1f UseColorOnly; FBufferedUniform1f UsePalette; FBufferedUniform1f UseDetailMapping; @@ -48,7 +47,6 @@ public: FBufferedUniform1f NPOTEmulationFactor; FBufferedUniform1f NPOTEmulationXOffset; FBufferedUniform1f Brightness; - FBufferedUniform4f Fog; FBufferedUniform4f FogColor; FBufferedUniform1f ShadeInterpolate; diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index 333e926f4..29443b355 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -385,12 +385,11 @@ void GLInstance::SetDepthFunc(int func) glDepthFunc(f[func]); } -void GLInstance::SetFogLinear(float* color, float start, float end) +void GLInstance::SetFadeColor(PalEntry color) { - renderState.Fog[0] = end; - renderState.Fog[1] = 1.f / (end - start); - renderState.Fog[2] = 0.f; - memcpy(renderState.FogColor, color, 4 * sizeof(float)); + renderState.FogColor[0] = color.r * (1 / 255.f); + renderState.FogColor[1] = color.g * (1 / 255.f); + renderState.FogColor[2] = color.b * (1 / 255.f); }; void GLInstance::SetColorMask(bool on) @@ -493,7 +492,6 @@ void PolymostRenderState::Apply(PolymostShader* shader) shader->Shade.Set(Shade); shader->NumShades.Set(NumShades); shader->VisFactor.Set(VisFactor); - shader->FogEnabled.Set(FogEnabled); shader->UseColorOnly.Set(UseColorOnly); shader->UsePalette.Set(UsePalette); shader->UseDetailMapping.Set(UseDetailMapping); @@ -503,7 +501,6 @@ void PolymostRenderState::Apply(PolymostShader* shader) shader->NPOTEmulationXOffset.Set(NPOTEmulationXOffset); shader->ShadeInterpolate.Set(ShadeInterpolate); shader->Brightness.Set(Brightness); - shader->Fog.Set(Fog); shader->FogColor.Set(FogColor); } diff --git a/source/glbackend/glbackend.h b/source/glbackend/glbackend.h index eeb4d6675..e41c3277a 100644 --- a/source/glbackend/glbackend.h +++ b/source/glbackend/glbackend.h @@ -20,7 +20,6 @@ struct PaletteData { int32_t crc32; PalEntry colors[256]; - float shades[512]; // two values (addshade and mulshade for each palswap.) bool shadesdone; int whiteindex, blackindex; FHardwareTexture* paltexture; @@ -37,6 +36,7 @@ struct PalswapData int32_t crc32; const uint8_t *lookup; // points to the original data. This is static so no need to copy FHardwareTexture* swaptexture; + PalEntry fadeColor; }; enum @@ -278,7 +278,7 @@ public: } void SetDepthFunc(int func); - void SetFogLinear(float* color, float start, float end); + void SetFadeColor(PalEntry color); void SetColorMask(bool on); void SetDepthMask(bool on); void SetBlendFunc(int src, int dst); @@ -331,11 +331,6 @@ public: renderState.VisFactor = visibility * fviewingrange * (1.f / (64.f * 65536.f)); } - void SetFogEnabled(bool fogEnabled) - { - renderState.FogEnabled = fogEnabled; - } - void UseColorOnly(bool useColorOnly) { renderState.UseColorOnly = useColorOnly; diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index 89944682e..3aba3cd70 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -318,8 +318,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 xvect2 = mulscale16(xvect, yxaspect); yvect2 = mulscale16(yvect, yxaspect); - renderDisableFog(); - //Draw red lines for (i=numsectors-1; i>=0; i--) { @@ -362,8 +360,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 } } - renderEnableFog(); - //Draw sprites k = g_player[screenpeek].ps->i; for (i=numsectors-1; i>=0; i--) @@ -509,8 +505,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 } } - renderDisableFog(); - //Draw white lines for (i=numsectors-1; i>=0; i--) { @@ -551,8 +545,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 } } - renderEnableFog(); - videoSetCorrectedAspect(); for (TRAVERSE_CONNECT(p)) diff --git a/source/sw/src/anim.cpp b/source/sw/src/anim.cpp index 57963efd9..b6ce4ec70 100644 --- a/source/sw/src/anim.cpp +++ b/source/sw/src/anim.cpp @@ -310,7 +310,7 @@ playanm(short anim_num) videoClearViewableArea(0L); - paletteSetColorTable(0, ANIMvesapal); + paletteSetColorTable(0, ANIMvesapal, true); videoSetPalette(gs.Brightness,0,2); if (ANIMnum == 1) { diff --git a/wadsrc/static/demolition/shaders/glsl/polymost.fp b/wadsrc/static/demolition/shaders/glsl/polymost.fp index aa5590ffe..18bd37048 100644 --- a/wadsrc/static/demolition/shaders/glsl/polymost.fp +++ b/wadsrc/static/demolition/shaders/glsl/polymost.fp @@ -24,7 +24,6 @@ uniform float u_npotEmulationFactor; uniform float u_npotEmulationXOffset; uniform float u_shadeInterpolate; uniform float u_brightness; -uniform vec4 u_fog; uniform vec4 u_fogColor; uniform float u_useDetailMapping; @@ -189,17 +188,6 @@ void main() if (fullbright == 0.0) color.rgb *= v_color.rgb; color.a *= v_color.a; color.rgb *= detailColor.rgb; - - if (u_fogEnabled != 0.0 && u_usePalette == 0.0)// the following would make sense if 'fullbright' could ever be true in non-paletted rendering: && (fullbright != 0.0 || u_fogColor.rgb != vec3(0.0) )) - { - float fogFactor; - - if (u_fog.z == 0) fogFactor = (u_fog.x-v_fogCoord)*u_fog.y; // linear fog - else fogFactor = exp2 (u_fog.z * v_fogCoord); // exponential fog - - fogFactor = clamp(fogFactor, 0.0, 1.0); - color.rgb = mix(u_fogColor.rgb, color.rgb, fogFactor); - } } else {