Redo OpenGL skewing support, so that it now itself supports the lower unpegged effect for FOFs in OpenGL!

This commit is contained in:
Monster Iestyn 2018-09-28 17:02:02 +01:00
parent 90ebce0557
commit 872e2f82c1

View file

@ -2183,6 +2183,10 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
else if (drawtextured) else if (drawtextured)
{ {
fixed_t texturevpeg; fixed_t texturevpeg;
boolean attachtobottom = false;
#ifdef ESLOPE
boolean slopeskew = false; // skew FOF walls with slopes?
#endif
// Wow, how was this missing from OpenGL for so long? // Wow, how was this missing from OpenGL for so long?
// ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software // ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software
@ -2190,24 +2194,50 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
if (newline) if (newline)
{ {
texturevpeg = sides[newline->sidenum[0]].rowoffset; texturevpeg = sides[newline->sidenum[0]].rowoffset;
if (newline->flags & ML_DONTPEGBOTTOM) attachtobottom = !!(newline->flags & ML_DONTPEGBOTTOM);
texturevpeg -= *rover->topheight - *rover->bottomheight; #ifdef ESLOPE
slopeskew = !!(newline->flags & ML_DONTPEGTOP);
#endif
} }
else else
{ {
texturevpeg = sides[rover->master->sidenum[0]].rowoffset; texturevpeg = sides[rover->master->sidenum[0]].rowoffset;
if (gr_linedef->flags & ML_DONTPEGBOTTOM) attachtobottom = !!(gr_linedef->flags & ML_DONTPEGBOTTOM);
texturevpeg -= *rover->topheight - *rover->bottomheight; #ifdef ESLOPE
slopeskew = !!(rover->master->flags & ML_DONTPEGTOP);
#endif
} }
grTex = HWR_GetTexture(texnum); grTex = HWR_GetTexture(texnum);
#ifdef ESLOPE #ifdef ESLOPE
wallVerts[3].t = (*rover->topheight - h + texturevpeg) * grTex->scaleY; if (!slopeskew) // no skewing
wallVerts[2].t = (*rover->topheight - hS + texturevpeg) * grTex->scaleY; {
wallVerts[0].t = (*rover->topheight - l + texturevpeg) * grTex->scaleY; if (attachtobottom)
wallVerts[1].t = (*rover->topheight - lS + texturevpeg) * grTex->scaleY; texturevpeg -= *rover->topheight - *rover->bottomheight;
wallVerts[3].t = (*rover->topheight - h + texturevpeg) * grTex->scaleY;
wallVerts[2].t = (*rover->topheight - hS + texturevpeg) * grTex->scaleY;
wallVerts[0].t = (*rover->topheight - l + texturevpeg) * grTex->scaleY;
wallVerts[1].t = (*rover->topheight - lS + texturevpeg) * grTex->scaleY;
}
else
{
if (!attachtobottom) // skew by top
{
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
wallVerts[0].t = (h - l + texturevpeg) * grTex->scaleY;
wallVerts[1].t = (hS - lS + texturevpeg) * grTex->scaleY;
}
else // skew by bottom
{
wallVerts[0].t = wallVerts[1].t = texturevpeg * grTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (h - l) * grTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (hS - lS) * grTex->scaleY;
}
}
#else #else
if (attachtobottom)
texturevpeg -= *rover->topheight - *rover->bottomheight;
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + texturevpeg) * grTex->scaleY; wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + texturevpeg) * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (*rover->topheight - l + texturevpeg) * grTex->scaleY; wallVerts[0].t = wallVerts[1].t = (*rover->topheight - l + texturevpeg) * grTex->scaleY;
#endif #endif