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
This commit is contained in:
helixhorned 2012-10-01 17:52:22 +00:00
parent 735d1ed77e
commit b3daea46d6
3 changed files with 28 additions and 7 deletions

View file

@ -5,6 +5,9 @@
#include "hightile.h" #include "hightile.h"
#define MODEL_OCCLUSION_CHECKING
#ifdef MODEL_OCCLUSION_CHECKING
# define CULL_OFFSET 384 # define CULL_OFFSET 384
# define CULL_DELAY 2 # define CULL_DELAY 2
# define MAXCULLCHECKS 1024 # define MAXCULLCHECKS 1024
@ -12,6 +15,7 @@
extern int32_t lastcullcheck; extern int32_t lastcullcheck;
extern char cullmodel[MAXSPRITES]; extern char cullmodel[MAXSPRITES];
extern int32_t cullcheckcnt; extern int32_t cullcheckcnt;
#endif
extern char TEXCACHEFILE[BMAX_PATH]; extern char TEXCACHEFILE[BMAX_PATH];

View file

@ -8901,7 +8901,9 @@ killsprite:
{ {
#ifdef USE_OPENGL #ifdef USE_OPENGL
curpolygonoffset = 0; curpolygonoffset = 0;
# ifdef MODEL_OCCLUSION_CHECKING
cullcheckcnt = 0; cullcheckcnt = 0;
# endif
#endif #endif
pos.x = (float)globalposx; pos.x = (float)globalposx;
pos.y = (float)globalposy; pos.y = (float)globalposy;
@ -8958,7 +8960,7 @@ killsprite:
if (tspriteptr[spritesortcnt] != NULL) if (tspriteptr[spritesortcnt] != NULL)
drawsprite(spritesortcnt); drawsprite(spritesortcnt);
} }
#ifdef USE_OPENGL #ifdef MODEL_OCCLUSION_CHECKING
if (totalclock < lastcullcheck - CULL_DELAY) if (totalclock < lastcullcheck - CULL_DELAY)
lastcullcheck = totalclock; lastcullcheck = totalclock;
if (totalclock >= lastcullcheck + CULL_DELAY) if (totalclock >= lastcullcheck + CULL_DELAY)

View file

@ -4815,6 +4815,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
drawpoly(dpx,dpy,n,method); drawpoly(dpx,dpy,n,method);
} }
#ifdef MODEL_OCCLUSION_CHECKING
int32_t lastcullcheck = 0; int32_t lastcullcheck = 0;
char cullmodel[MAXSPRITES]; char cullmodel[MAXSPRITES];
int32_t cullcheckcnt = 0; int32_t cullcheckcnt = 0;
@ -4862,6 +4863,7 @@ RECHECK:
return 0; return 0;
} }
#endif
void polymost_drawsprite(int32_t snum) void polymost_drawsprite(int32_t snum)
{ {
@ -4916,6 +4918,8 @@ void polymost_drawsprite(int32_t snum)
if (mddraw(tspr)) return; if (mddraw(tspr)) return;
break; // else, render as flat sprite break; // else, render as flat sprite
} }
# ifdef MODEL_OCCLUSION_CHECKING
if (r_modelocclusionchecking) 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)) 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; 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 break; // else, render as flat sprite
} }
if (usevoxels && (tspr->cstat&48)!=48 && tiletovox[tspr->picnum] >= 0 && voxmodels[tiletovox[tspr->picnum]]) 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 break; // else, render as flat sprite
} }
if ((tspr->cstat&48)==48 && voxmodels[tspr->picnum]) if ((tspr->cstat&48)==48 && voxmodels[tspr->picnum])
{ {
voxdraw(voxmodels[tspr->picnum], tspr); voxdraw(voxmodels[tspr->picnum], tspr);
@ -4972,6 +4984,7 @@ void polymost_drawsprite(int32_t snum)
} }
break; break;
} }
if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal)))) if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal))))
{ {
curpolygonoffset += 0.01f; curpolygonoffset += 0.01f;
@ -4979,6 +4992,7 @@ void polymost_drawsprite(int32_t snum)
bglPolygonOffset(-curpolygonoffset, -curpolygonoffset); bglPolygonOffset(-curpolygonoffset, -curpolygonoffset);
} }
#endif #endif
posx=tspr->x; posx=tspr->x;
posy=tspr->y; posy=tspr->y;
if (spriteext[tspr->owner].flags&SPREXT_AWAY1) if (spriteext[tspr->owner].flags&SPREXT_AWAY1)
@ -4991,6 +5005,7 @@ void polymost_drawsprite(int32_t snum)
posx-=(sintable[(tspr->ang+512)&2047]>>13); posx-=(sintable[(tspr->ang+512)&2047]>>13);
posy-=(sintable[(tspr->ang)&2047]>>13); posy-=(sintable[(tspr->ang)&2047]>>13);
} }
oldsizx=tsizx=tilesizx[globalpicnum]; oldsizx=tsizx=tilesizx[globalpicnum];
oldsizy=tsizy=tilesizy[globalpicnum]; oldsizy=tsizy=tilesizy[globalpicnum];
if (usehightile && h_xsize[globalpicnum]) if (usehightile && h_xsize[globalpicnum])