- fixed rendering of two-sided polyobjects that have their upper or lower textures exposed.

This commit is contained in:
Christoph Oelckers 2016-01-05 18:59:32 +01:00
parent ea6c498470
commit 7d2bbbd351

View file

@ -1418,9 +1418,11 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
fixed_t ffh2; fixed_t ffh2;
sector_t * realfront; sector_t * realfront;
sector_t * realback; sector_t * realback;
sector_t * segfront;
sector_t * segback;
#ifdef _DEBUG #ifdef _DEBUG
if (seg->linedef-lines==5835) if (seg->linedef-lines==904)
{ {
int a = 0; int a = 0;
} }
@ -1433,14 +1435,16 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
if ((seg->sidedef->Flags & WALLF_POLYOBJ) && seg->backsector) if ((seg->sidedef->Flags & WALLF_POLYOBJ) && seg->backsector)
{ {
// Textures on 2-sided polyobjects are aligned to the actual seg's sectors // Textures on 2-sided polyobjects are aligned to the actual seg's sectors
realfront = seg->frontsector; segfront = realfront = seg->frontsector;
realback = seg->backsector; segback = realback = seg->backsector;
} }
else else
{ {
// Need these for aligning the textures // Need these for aligning the textures
realfront = &sectors[frontsector->sectornum]; realfront = &sectors[frontsector->sectornum];
realback = backsector ? &sectors[backsector->sectornum] : NULL; realback = backsector ? &sectors[backsector->sectornum] : NULL;
segfront = frontsector;
segback = backsector;
} }
if (seg->sidedef == seg->linedef->sidedef[0]) if (seg->sidedef == seg->linedef->sidedef[0])
@ -1521,27 +1525,27 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
// Save a little time (up to 0.3 ms per frame ;) ) // Save a little time (up to 0.3 ms per frame ;) )
if (frontsector->floorplane.a | frontsector->floorplane.b) if (frontsector->floorplane.a | frontsector->floorplane.b)
{ {
ffh1 = frontsector->floorplane.ZatPoint(v1); ffh1 = segfront->floorplane.ZatPoint(v1);
ffh2 = frontsector->floorplane.ZatPoint(v2); ffh2 = segfront->floorplane.ZatPoint(v2);
zfloor[0] = FIXED2FLOAT(ffh1); zfloor[0] = FIXED2FLOAT(ffh1);
zfloor[1] = FIXED2FLOAT(ffh2); zfloor[1] = FIXED2FLOAT(ffh2);
} }
else else
{ {
ffh1 = ffh2 = -frontsector->floorplane.d; ffh1 = ffh2 = -segfront->floorplane.d;
zfloor[0] = zfloor[1] = FIXED2FLOAT(ffh2); zfloor[0] = zfloor[1] = FIXED2FLOAT(ffh2);
} }
if (frontsector->ceilingplane.a | frontsector->ceilingplane.b) if (segfront->ceilingplane.a | segfront->ceilingplane.b)
{ {
fch1 = frontsector->ceilingplane.ZatPoint(v1); fch1 = segfront->ceilingplane.ZatPoint(v1);
fch2 = frontsector->ceilingplane.ZatPoint(v2); fch2 = segfront->ceilingplane.ZatPoint(v2);
zceil[0] = FIXED2FLOAT(fch1); zceil[0] = FIXED2FLOAT(fch1);
zceil[1] = FIXED2FLOAT(fch2); zceil[1] = FIXED2FLOAT(fch2);
} }
else else
{ {
fch1 = fch2 = frontsector->ceilingplane.d; fch1 = fch2 = segfront->ceilingplane.d;
zceil[0] = zceil[1] = FIXED2FLOAT(fch2); zceil[0] = zceil[1] = FIXED2FLOAT(fch2);
} }
@ -1577,24 +1581,24 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
fixed_t bfh1; fixed_t bfh1;
fixed_t bfh2; fixed_t bfh2;
if (backsector->floorplane.a | backsector->floorplane.b) if (segback->floorplane.a | segback->floorplane.b)
{ {
bfh1 = backsector->floorplane.ZatPoint(v1); bfh1 = segback->floorplane.ZatPoint(v1);
bfh2 = backsector->floorplane.ZatPoint(v2); bfh2 = segback->floorplane.ZatPoint(v2);
} }
else else
{ {
bfh1 = bfh2 = -backsector->floorplane.d; bfh1 = bfh2 = -segback->floorplane.d;
} }
if (backsector->ceilingplane.a | backsector->ceilingplane.b) if (segback->ceilingplane.a | segback->ceilingplane.b)
{ {
bch1 = backsector->ceilingplane.ZatPoint(v1); bch1 = segback->ceilingplane.ZatPoint(v1);
bch2 = backsector->ceilingplane.ZatPoint(v2); bch2 = segback->ceilingplane.ZatPoint(v2);
} }
else else
{ {
bch1 = bch2 = backsector->ceilingplane.d; bch1 = bch2 = segback->ceilingplane.d;
} }
SkyTop(seg, frontsector, backsector, v1, v2); SkyTop(seg, frontsector, backsector, v1, v2);
@ -1623,7 +1627,9 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
realfront->GetPlaneTexZ(sector_t::ceiling), realback->GetPlaneTexZ(sector_t::ceiling), realfront->GetPlaneTexZ(sector_t::ceiling), realback->GetPlaneTexZ(sector_t::ceiling),
fch1, fch2, bch1a, bch2a, 0); fch1, fch2, bch1a, bch2a, 0);
} }
else if ((frontsector->ceilingplane.a | frontsector->ceilingplane.b | else if (!(seg->sidedef->Flags & WALLF_POLYOBJ))
{
if ((frontsector->ceilingplane.a | frontsector->ceilingplane.b |
backsector->ceilingplane.a | backsector->ceilingplane.b) && backsector->ceilingplane.a | backsector->ceilingplane.b) &&
frontsector->GetTexture(sector_t::ceiling) != skyflatnum && frontsector->GetTexture(sector_t::ceiling) != skyflatnum &&
backsector->GetTexture(sector_t::ceiling) != skyflatnum) backsector->GetTexture(sector_t::ceiling) != skyflatnum)
@ -1636,7 +1642,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
fch1, fch2, bch1a, bch2a, 0); fch1, fch2, bch1a, bch2a, 0);
} }
} }
else if (!(seg->sidedef->Flags & WALLF_POLYOBJ)) else
{ {
// skip processing if the back is a malformed subsector // skip processing if the back is a malformed subsector
if (seg->PartnerSeg != NULL && !(seg->PartnerSeg->Subsector->hacked & 4)) if (seg->PartnerSeg != NULL && !(seg->PartnerSeg->Subsector->hacked & 4))
@ -1646,6 +1652,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
} }
} }
} }
}
/* mid texture */ /* mid texture */
@ -1692,7 +1699,9 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
realfront->GetPlaneTexZ(sector_t::floor) - realback->GetPlaneTexZ(sector_t::ceiling) : realfront->GetPlaneTexZ(sector_t::floor) - realback->GetPlaneTexZ(sector_t::ceiling) :
realfront->GetPlaneTexZ(sector_t::floor) - realfront->GetPlaneTexZ(sector_t::ceiling)); realfront->GetPlaneTexZ(sector_t::floor) - realfront->GetPlaneTexZ(sector_t::ceiling));
} }
else if ((frontsector->floorplane.a | frontsector->floorplane.b | else if (!(seg->sidedef->Flags & WALLF_POLYOBJ))
{
if ((frontsector->floorplane.a | frontsector->floorplane.b |
backsector->floorplane.a | backsector->floorplane.b) && backsector->floorplane.a | backsector->floorplane.b) &&
frontsector->GetTexture(sector_t::floor) != skyflatnum && frontsector->GetTexture(sector_t::floor) != skyflatnum &&
backsector->GetTexture(sector_t::floor) != skyflatnum) backsector->GetTexture(sector_t::floor) != skyflatnum)
@ -1708,8 +1717,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
bfh1, bfh2, ffh1, ffh2, realfront->GetPlaneTexZ(sector_t::floor) - realfront->GetPlaneTexZ(sector_t::ceiling)); bfh1, bfh2, ffh1, ffh2, realfront->GetPlaneTexZ(sector_t::floor) - realfront->GetPlaneTexZ(sector_t::ceiling));
} }
} }
else if (backsector->GetTexture(sector_t::floor) != skyflatnum && else if (backsector->GetTexture(sector_t::floor) != skyflatnum)
!(seg->sidedef->Flags & WALLF_POLYOBJ))
{ {
// skip processing if the back is a malformed subsector // skip processing if the back is a malformed subsector
if (seg->PartnerSeg != NULL && !(seg->PartnerSeg->Subsector->hacked & 4)) if (seg->PartnerSeg != NULL && !(seg->PartnerSeg->Subsector->hacked & 4))
@ -1720,6 +1728,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
} }
} }
} }
}
//========================================================================== //==========================================================================
// //