From c9014870e33b43585c8a26f9f117e0d78fd4beb7 Mon Sep 17 00:00:00 2001 From: pogokeen Date: Fri, 5 Jul 2019 21:17:54 +0000 Subject: [PATCH] Improve depth fighting by pushing out the near plane and improve near plane clipping by depth clamping. Suggest reducing SCISDIST when there's time to debug SCISDIST issues. git-svn-id: https://svn.eduke32.com/eduke32@7754 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/polymost.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index db2c80316..797af4a92 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -42,7 +42,9 @@ static int32_t yax_drawcf = -1; static float dxb1[MAXWALLSB], dxb2[MAXWALLSB]; -#define SCISDIST 1.0f //1.0: Close plane clipping distance +//POGOTODO: the SCISDIST could be set to 0 now to allow close objects to render properly, +// but there's a nasty rendering bug that needs to be dug into when setting SCISDIST lower than 1 +#define SCISDIST 1.f //close plane clipping distance #define SOFTROTMAT 0 @@ -759,6 +761,9 @@ void polymost_glinit() glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + if (glinfo.depthclamp) + glEnable(GL_DEPTH_CLAMP); + //glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); //glEnable(GL_LINE_SMOOTH); @@ -1393,7 +1398,7 @@ static void resizeglcheck(void) float m[4][4]; Bmemset(m,0,sizeof(m)); - float const nearclip = SCISDIST / (gxyaspect * gyxscale * 1024.f); + float const nearclip = 4.0f / (gxyaspect * gyxscale * 1024.f); float const farclip = 64.f; gloxyaspect = gxyaspect;