Polymer: sanitize backface culling

Keep track of which side is getting culled, swap around mirrors, swap
around model drawing.

git-svn-id: https://svn.eduke32.com/eduke32@2032 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2011-09-18 07:18:50 +00:00
parent 6f4fedb7fe
commit 03429e8f2e
2 changed files with 14 additions and 4 deletions

View file

@ -374,6 +374,8 @@ static void polymer_initrendertargets(int32_t count);
#define INDICE(n) ((p->indices) ? (p->indices[(i+n)%p->indicescount]*5) : (((i+n)%p->vertcount)*5))
#define SWITCH_CULL_DIRECTION culledface = (culledface == GL_FRONT) ? GL_BACK : GL_FRONT; bglCullFace(culledface)
static inline GLfloat dot2f(GLfloat *v1, GLfloat *v2)
{
return v1[0]*v2[0] + v1[1]*v2[1];

View file

@ -629,6 +629,8 @@ _pranimatespritesinfo asi;
int32_t polymersearching;
int32_t culledface;
// EXTERNAL FUNCTIONS
int32_t polymer_init(void)
{
@ -813,8 +815,10 @@ void polymer_glinit(void)
bglDisable(GL_FOG);
bglEnable(GL_CULL_FACE);
culledface = GL_BACK;
bglCullFace(GL_BACK);
bglEnable(GL_CULL_FACE);
}
void polymer_resetlights(void)
@ -1319,7 +1323,11 @@ void polymer_drawsprite(int32_t snum)
tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0 &&
!(spriteext[tspr->owner].flags & SPREXT_NOTMD))
{
bglEnable(GL_CULL_FACE);
SWITCH_CULL_DIRECTION;
polymer_drawmdsprite(tspr);
SWITCH_CULL_DIRECTION;
bglDisable(GL_CULL_FACE);
return;
}
@ -1785,7 +1793,7 @@ static void polymer_displayrooms(int16_t dacursectnum)
bglClipPlane(GL_CLIP_PLANE0, plane);
polymer_inb4mirror(mirrorlist[i].plane->buffer, mirrorlist[i].plane->plane);
bglCullFace(GL_FRONT);
SWITCH_CULL_DIRECTION;
//bglEnable(GL_CLIP_PLANE0);
if (mirrorlist[i].wallnum >= 0)
@ -1833,7 +1841,7 @@ static void polymer_displayrooms(int16_t dacursectnum)
globalposz = gz;
bglDisable(GL_CLIP_PLANE0);
bglCullFace(GL_BACK);
SWITCH_CULL_DIRECTION;
bglMatrixMode(GL_MODELVIEW);
bglPopMatrix();