diff --git a/src/gl/compatibility/gl_20.cpp b/src/gl/compatibility/gl_20.cpp index 15d52c48a..ecbc32831 100644 --- a/src/gl/compatibility/gl_20.cpp +++ b/src/gl/compatibility/gl_20.cpp @@ -500,6 +500,33 @@ bool GLWall::PutWallCompat(int passflag) } +//========================================================================== +// +// +// +//========================================================================== + +bool GLFlat::PutFlatCompat(bool fog) +{ + // are lights possible? + if (gl_fixedcolormap != CM_DEFAULT || !gl_lights || !gltexture || renderstyle != STYLE_Translucent || alpha < 1.f - FLT_EPSILON || sector->lighthead == NULL) return false; + + static int list_indices[2][2] = + { { GLLDL_FLATS_PLAIN, GLLDL_FLATS_FOG },{ GLLDL_FLATS_MASKED, GLLDL_FLATS_FOGMASKED } }; + + bool masked = gltexture->isMasked() && ((renderflags&SSRF_RENDER3DPLANES) || stack); + bool foggy = gl_CheckFog(&Colormap, lightlevel) || level.flags&LEVEL_HASFADETABLE; + + + int list = list_indices[masked][foggy]; + if (list == GLLDL_FLATS_PLAIN) + { + if (gltexture->tex->gl_info.Brightmap && gl.glslversion >= 0.f) list = GLLDL_FLATS_BRIGHT; + } + gl_drawinfo->dldrawlists[list].AddFlat(this); +} + + //========================================================================== // // Fog boundary without any shader support diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 7406bb20e..6b6f0e4a9 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -463,6 +463,10 @@ inline void GLFlat::PutFlat(bool fog) { Colormap.Clear(); } + if (gl.lightmethod == LM_SOFTWARE) + { + if (PutFlatCompat(fog)) return; + } if (renderstyle!=STYLE_Translucent || alpha < 1.f - FLT_EPSILON || fog || gltexture == NULL) { // translucent 3D floors go into the regular translucent list, translucent portals go into the translucent border list. diff --git a/src/gl/scene/gl_wall.h b/src/gl/scene/gl_wall.h index fdf78ee6f..cb443cd2a 100644 --- a/src/gl/scene/gl_wall.h +++ b/src/gl/scene/gl_wall.h @@ -304,6 +304,7 @@ public: void ProcessLights(bool istrans); void PutFlat(bool fog = false); + bool PutFlatCompat(bool fog); void Process(sector_t * model, int whichplane, bool notexture); void SetFrom3DFloor(F3DFloor *rover, bool top, bool underside); void ProcessSector(sector_t * frontsector);