From b3daea46d67d72033fd735ac83621fb2befd37d4 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 1 Oct 2012 17:52:22 +0000 Subject: [PATCH] Add compilation switch MODEL_OCCLUSION_CHECKING to polymost.h, leave it enabled. git-svn-id: https://svn.eduke32.com/eduke32@3040 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/polymost.h | 10 +++++++--- polymer/eduke32/build/src/engine.c | 4 +++- polymer/eduke32/build/src/polymost.c | 21 ++++++++++++++++++--- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/polymer/eduke32/build/include/polymost.h b/polymer/eduke32/build/include/polymost.h index ef8d9b741..790552f5c 100644 --- a/polymer/eduke32/build/include/polymost.h +++ b/polymer/eduke32/build/include/polymost.h @@ -5,13 +5,17 @@ #include "hightile.h" -#define CULL_OFFSET 384 -#define CULL_DELAY 2 -#define MAXCULLCHECKS 1024 +#define MODEL_OCCLUSION_CHECKING + +#ifdef MODEL_OCCLUSION_CHECKING +# define CULL_OFFSET 384 +# define CULL_DELAY 2 +# define MAXCULLCHECKS 1024 extern int32_t lastcullcheck; extern char cullmodel[MAXSPRITES]; extern int32_t cullcheckcnt; +#endif extern char TEXCACHEFILE[BMAX_PATH]; diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 7bdc23aa4..95e82473a 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -8901,7 +8901,9 @@ killsprite: { #ifdef USE_OPENGL curpolygonoffset = 0; +# ifdef MODEL_OCCLUSION_CHECKING cullcheckcnt = 0; +# endif #endif pos.x = (float)globalposx; pos.y = (float)globalposy; @@ -8958,7 +8960,7 @@ killsprite: if (tspriteptr[spritesortcnt] != NULL) drawsprite(spritesortcnt); } -#ifdef USE_OPENGL +#ifdef MODEL_OCCLUSION_CHECKING if (totalclock < lastcullcheck - CULL_DELAY) lastcullcheck = totalclock; if (totalclock >= lastcullcheck + CULL_DELAY) diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 5703696f3..e5c95f2a7 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -4815,6 +4815,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt) drawpoly(dpx,dpy,n,method); } +#ifdef MODEL_OCCLUSION_CHECKING int32_t lastcullcheck = 0; char cullmodel[MAXSPRITES]; int32_t cullcheckcnt = 0; @@ -4862,6 +4863,7 @@ RECHECK: return 0; } +#endif void polymost_drawsprite(int32_t snum) { @@ -4916,6 +4918,8 @@ void polymost_drawsprite(int32_t snum) if (mddraw(tspr)) return; break; // else, render as flat sprite } + +# ifdef MODEL_OCCLUSION_CHECKING if (r_modelocclusionchecking) { if (totalclock >= lastcullcheck + CULL_DELAY && cullcheckcnt < MAXCULLCHECKS && (/*modelptr->usesalpha ||*/ tspr->yrepeat*tilesizy[sprite[tspr->owner].picnum] > 1536 || tspr->xrepeat*tilesizx[sprite[tspr->owner].picnum] > 1536)) @@ -4956,15 +4960,23 @@ void polymost_drawsprite(int32_t snum) } } else cullmodel[tspr->owner] = 0; - if (cullmodel[tspr->owner]) break; - if (mddraw(tspr)) return; + + if (cullmodel[tspr->owner]) + break; +# endif + if (mddraw(tspr)) + return; + break; // else, render as flat sprite } + if (usevoxels && (tspr->cstat&48)!=48 && tiletovox[tspr->picnum] >= 0 && voxmodels[tiletovox[tspr->picnum]]) { - if (voxdraw(voxmodels[tiletovox[tspr->picnum]], tspr)) return; + if (voxdraw(voxmodels[tiletovox[tspr->picnum]], tspr)) + return; break; // else, render as flat sprite } + if ((tspr->cstat&48)==48 && voxmodels[tspr->picnum]) { voxdraw(voxmodels[tspr->picnum], tspr); @@ -4972,6 +4984,7 @@ void polymost_drawsprite(int32_t snum) } break; } + if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal)))) { curpolygonoffset += 0.01f; @@ -4979,6 +4992,7 @@ void polymost_drawsprite(int32_t snum) bglPolygonOffset(-curpolygonoffset, -curpolygonoffset); } #endif + posx=tspr->x; posy=tspr->y; if (spriteext[tspr->owner].flags&SPREXT_AWAY1) @@ -4991,6 +5005,7 @@ void polymost_drawsprite(int32_t snum) posx-=(sintable[(tspr->ang+512)&2047]>>13); posy-=(sintable[(tspr->ang)&2047]>>13); } + oldsizx=tsizx=tilesizx[globalpicnum]; oldsizy=tsizy=tilesizy[globalpicnum]; if (usehightile && h_xsize[globalpicnum])