- some minor fixing and cleanup on gL portal code.

This commit is contained in:
Christoph Oelckers 2016-04-20 11:39:41 +02:00
parent b0a0fb5ff0
commit 1f32f5a258
11 changed files with 74 additions and 69 deletions

View file

@ -51,7 +51,7 @@ struct FPortal
int plane; int plane;
GLSectorStackPortal *glportal; // for quick access to the render data. This is only valid during BSP traversal! GLSectorStackPortal *glportal; // for quick access to the render data. This is only valid during BSP traversal!
GLSectorStackPortal *GetGLPortal(); GLSectorStackPortal *GetRenderState();
}; };
struct FGLLinePortal struct FGLLinePortal
@ -68,7 +68,7 @@ extern TArray<FGLLinePortal*> linePortalToGL;
extern TArray<BYTE> currentmapsection; extern TArray<BYTE> currentmapsection;
void gl_InitPortals(); void gl_InitPortals();
void gl_BuildPortalCoverage(FPortalCoverage *coverage, subsector_t *subsector, FPortal *portal); void gl_BuildPortalCoverage(FPortalCoverage *coverage, subsector_t *subsector, const DVector2 &displacement);
void gl_InitData(); void gl_InitData();
extern long gl_frameMS; extern long gl_frameMS;

View file

@ -94,7 +94,7 @@ TArray<FGLLinePortal> glLinePortals;
// //
//========================================================================== //==========================================================================
GLSectorStackPortal *FPortal::GetGLPortal() GLSectorStackPortal *FPortal::GetRenderState()
{ {
if (glportal == NULL) glportal = new GLSectorStackPortal(this); if (glportal == NULL) glportal = new GLSectorStackPortal(this);
return glportal; return glportal;
@ -125,7 +125,6 @@ struct FCoverageLine
struct FCoverageBuilder struct FCoverageBuilder
{ {
subsector_t *target; subsector_t *target;
FPortal *portal;
TArray<int> collect; TArray<int> collect;
FCoverageVertex center; FCoverageVertex center;
@ -135,10 +134,9 @@ struct FCoverageBuilder
// //
//========================================================================== //==========================================================================
FCoverageBuilder(subsector_t *sub, FPortal *port) FCoverageBuilder(subsector_t *sub)
{ {
target = sub; target = sub;
portal = port;
} }
//========================================================================== //==========================================================================
@ -322,7 +320,7 @@ struct FCoverageBuilder
// //
//========================================================================== //==========================================================================
void gl_BuildPortalCoverage(FPortalCoverage *coverage, subsector_t *subsector, FPortal *portal) void gl_BuildPortalCoverage(FPortalCoverage *coverage, subsector_t *subsector, const DVector2 &displacement)
{ {
TArray<FCoverageVertex> shape; TArray<FCoverageVertex> shape;
double centerx=0, centery=0; double centerx=0, centery=0;
@ -330,11 +328,11 @@ void gl_BuildPortalCoverage(FPortalCoverage *coverage, subsector_t *subsector, F
shape.Resize(subsector->numlines); shape.Resize(subsector->numlines);
for(unsigned i=0; i<subsector->numlines; i++) for(unsigned i=0; i<subsector->numlines; i++)
{ {
centerx += (shape[i].x = FLOAT2FIXED(subsector->firstline[i].v1->fX() + portal->mDisplacement.X)); centerx += (shape[i].x = FLOAT2FIXED(subsector->firstline[i].v1->fX() + displacement.X));
centery += (shape[i].y = FLOAT2FIXED(subsector->firstline[i].v1->fY() + portal->mDisplacement.Y)); centery += (shape[i].y = FLOAT2FIXED(subsector->firstline[i].v1->fY() + displacement.Y));
} }
FCoverageBuilder build(subsector, portal); FCoverageBuilder build(subsector);
build.center.x = xs_CRoundToInt(centerx / subsector->numlines); build.center.x = xs_CRoundToInt(centerx / subsector->numlines);
build.center.y = xs_CRoundToInt(centery / subsector->numlines); build.center.y = xs_CRoundToInt(centery / subsector->numlines);
@ -357,10 +355,10 @@ static void CollectPortalSectors(FPortalMap &collection)
sector_t *sec = &sectors[i]; sector_t *sec = &sectors[i];
for (int j = 0; j < 2; j++) for (int j = 0; j < 2; j++)
{ {
ASkyViewpoint *SkyBox = barrier_cast<ASkyViewpoint*>(sec->SkyBoxes[j]); int ptype = sec->GetPortalType(j);
if (SkyBox != NULL && SkyBox->bAlways && SkyBox->Mate != NULL) if (ptype== SKYBOX_STACKEDSECTORTHING || ptype == SKYBOX_PORTAL || ptype == SKYBOX_LINKEDPORTAL) // only offset-displacing portal types
{ {
FPortalID id = { {SkyBox->X() - SkyBox->Mate->X(), SkyBox->Y() - SkyBox->Mate->Y()} }; FPortalID id = { sec->GetPortalDisplacement(j) };
FPortalSectors &sss = collection[id]; FPortalSectors &sss = collection[id];
FPortalSector ss = { sec, j }; FPortalSector ss = { sec, j };
@ -401,8 +399,7 @@ void gl_InitPortals()
} }
for (int i=1;i<=2;i<<=1) for (int i=1;i<=2;i<<=1)
{ {
// For now, add separate portals for floor and ceiling. They can be merged once // add separate portals for floor and ceiling.
// proper plane clipping is in.
if (planeflags & i) if (planeflags & i)
{ {
FPortal *portal = new FPortal; FPortal *portal = new FPortal;
@ -419,7 +416,7 @@ void gl_InitPortals()
for(int k=0;k<sec->subsectorcount; k++) for(int k=0;k<sec->subsectorcount; k++)
{ {
subsector_t *sub = sec->subsectors[k]; subsector_t *sub = sec->subsectors[k];
gl_BuildPortalCoverage(&sub->portalcoverage[plane], sub, portal); gl_BuildPortalCoverage(&sub->portalcoverage[plane], sub, pair->Key.mDisplacement);
} }
sec->portals[plane] = portal; sec->portals[plane] = portal;
} }
@ -511,13 +508,13 @@ CCMD(dumpportals)
for(int j=0;j<numsubsectors;j++) for(int j=0;j<numsubsectors;j++)
{ {
subsector_t *sub = &subsectors[j]; subsector_t *sub = &subsectors[j];
FPortal *port = sub->render_sector->portals[portals[i]->plane]; FPortal *port = sub->render_sector->GetGLPortal(portals[i]->plane);
if (port == portals[i]) if (port == portals[i])
{ {
Printf(PRINT_LOG, "\tSubsector %d (%d):\n\t\t", j, sub->render_sector->sectornum); Printf(PRINT_LOG, "\tSubsector %d (%d):\n\t\t", j, sub->render_sector->sectornum);
for(unsigned k = 0;k< sub->numlines; k++) for(unsigned k = 0;k< sub->numlines; k++)
{ {
Printf(PRINT_LOG, "(%.3f,%.3f), ", sub->firstline[k].v1->fixX()/65536. + xdisp, sub->firstline[k].v1->fixY()/65536. + ydisp); Printf(PRINT_LOG, "(%.3f,%.3f), ", sub->firstline[k].v1->fX() + xdisp, sub->firstline[k].v1->fY() + ydisp);
} }
Printf(PRINT_LOG, "\n\t\tCovered by subsectors:\n"); Printf(PRINT_LOG, "\n\t\tCovered by subsectors:\n");
FPortalCoverage *cov = &sub->portalcoverage[portals[i]->plane]; FPortalCoverage *cov = &sub->portalcoverage[portals[i]->plane];
@ -527,7 +524,7 @@ CCMD(dumpportals)
Printf(PRINT_LOG, "\t\t\t%5d (%4d): ", cov->subsectors[l], csub->render_sector->sectornum); Printf(PRINT_LOG, "\t\t\t%5d (%4d): ", cov->subsectors[l], csub->render_sector->sectornum);
for(unsigned m = 0;m< csub->numlines; m++) for(unsigned m = 0;m< csub->numlines; m++)
{ {
Printf(PRINT_LOG, "(%.3f,%.3f), ", csub->firstline[m].v1->fixX()/65536., csub->firstline[m].v1->fixY()/65536.); Printf(PRINT_LOG, "(%.3f,%.3f), ", csub->firstline[m].v1->fX(), csub->firstline[m].v1->fY());
} }
Printf(PRINT_LOG, "\n"); Printf(PRINT_LOG, "\n");
} }

View file

@ -591,24 +591,23 @@ void ADynamicLight::CollectWithinRadius(const DVector3 &pos, subsector_t *subSec
} }
} }
} }
if (!subSec->sector->PortalBlocksSight(sector_t::ceiling)) sector_t *sec = subSec->sector;
if (!sec->PortalBlocksSight(sector_t::ceiling))
{ {
line_t *other = subSec->firstline->linedef; line_t *other = subSec->firstline->linedef;
AActor *sb = subSec->sector->SkyBoxes[sector_t::ceiling]; if (sec->GetPortalPlaneZ(sector_t::ceiling) < Z() + radius)
if (sb->specialf1 < Z() + radius)
{ {
DVector2 refpos = other->v1->fPos() + other->Delta() / 2 + sb->Scale; DVector2 refpos = other->v1->fPos() + other->Delta() / 2 + sec->GetPortalDisplacement(sector_t::ceiling);
subsector_t *othersub = R_PointInSubsector(refpos); subsector_t *othersub = R_PointInSubsector(refpos);
if (othersub->validcount != ::validcount) CollectWithinRadius(PosRelative(othersub->sector), othersub, radius); if (othersub->validcount != ::validcount) CollectWithinRadius(PosRelative(othersub->sector), othersub, radius);
} }
} }
if (!subSec->sector->PortalBlocksSight(sector_t::floor)) if (!sec->PortalBlocksSight(sector_t::floor))
{ {
line_t *other = subSec->firstline->linedef; line_t *other = subSec->firstline->linedef;
AActor *sb = subSec->sector->SkyBoxes[sector_t::floor]; if (sec->GetPortalPlaneZ(sector_t::floor) > Z() - radius)
if (sb->specialf1 > Z() - radius)
{ {
DVector2 refpos = other->v1->fPos() + other->Delta() / 2 + sb->Scale; DVector2 refpos = other->v1->fPos() + other->Delta() / 2 + sec->GetPortalDisplacement(sector_t::floor);
subsector_t *othersub = R_PointInSubsector(refpos); subsector_t *othersub = R_PointInSubsector(refpos);
if (othersub->validcount != ::validcount) CollectWithinRadius(PosRelative(othersub->sector), othersub, radius); if (othersub->validcount != ::validcount) CollectWithinRadius(PosRelative(othersub->sector), othersub, radius);
} }

View file

@ -494,7 +494,7 @@ static void DoSubsector(subsector_t * sub)
if (gl_render_flats) if (gl_render_flats)
{ {
// Subsectors with only 2 lines cannot have any area! // Subsectors with only 2 lines cannot have any area
if (sub->numlines>2 || (sub->hacked&1)) if (sub->numlines>2 || (sub->hacked&1))
{ {
// Exclude the case when it tries to render a sector with a heightsec // Exclude the case when it tries to render a sector with a heightsec
@ -527,17 +527,17 @@ static void DoSubsector(subsector_t * sub)
FPortal *portal; FPortal *portal;
portal = fakesector->portals[sector_t::ceiling]; portal = fakesector->GetGLPortal(sector_t::ceiling);
if (portal != NULL) if (portal != NULL)
{ {
GLSectorStackPortal *glportal = portal->GetGLPortal(); GLSectorStackPortal *glportal = portal->GetRenderState();
glportal->AddSubsector(sub); glportal->AddSubsector(sub);
} }
portal = fakesector->portals[sector_t::floor]; portal = fakesector->GetGLPortal(sector_t::floor);
if (portal != NULL) if (portal != NULL)
{ {
GLSectorStackPortal *glportal = portal->GetGLPortal(); GLSectorStackPortal *glportal = portal->GetRenderState();
glportal->AddSubsector(sub); glportal->AddSubsector(sub);
} }
} }

View file

@ -212,8 +212,8 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
dest->ceilingplane=sec->floorplane; dest->ceilingplane=sec->floorplane;
dest->ceilingplane.FlipVert(); dest->ceilingplane.FlipVert();
dest->planes[sector_t::ceiling].TexZ = dest->planes[sector_t::floor].TexZ; dest->planes[sector_t::ceiling].TexZ = dest->planes[sector_t::floor].TexZ;
dest->portals[sector_t::ceiling] = NULL; dest->ClearPortal(sector_t::ceiling);
dest->portals[sector_t::floor] = NULL; dest->ClearPortal(sector_t::floor);
return dest; return dest;
} }
} }
@ -314,7 +314,7 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
dest->vboindex[sector_t::ceiling] = sec->vboindex[sector_t::vbo_fakefloor]; dest->vboindex[sector_t::ceiling] = sec->vboindex[sector_t::vbo_fakefloor];
dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::floor]; dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::floor];
dest->portals[sector_t::ceiling] = NULL; dest->ClearPortal(sector_t::ceiling);
if (!(s->MoreFlags & SECF_NOFAKELIGHT)) if (!(s->MoreFlags & SECF_NOFAKELIGHT))
{ {
@ -367,7 +367,7 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
dest->vboindex[sector_t::ceiling] = sec->vboindex[sector_t::ceiling]; dest->vboindex[sector_t::ceiling] = sec->vboindex[sector_t::ceiling];
dest->vboheight[sector_t::ceiling] = sec->vboheight[sector_t::ceiling]; dest->vboheight[sector_t::ceiling] = sec->vboheight[sector_t::ceiling];
dest->portals[sector_t::floor] = NULL; dest->ClearPortal(sector_t::floor);
if (!(s->MoreFlags & SECF_NOFAKELIGHT)) if (!(s->MoreFlags & SECF_NOFAKELIGHT))
{ {

View file

@ -1180,20 +1180,21 @@ void GLHorizonPortal::DrawContents()
void GLEEHorizonPortal::DrawContents() void GLEEHorizonPortal::DrawContents()
{ {
PortalAll.Clock(); PortalAll.Clock();
if (origin->Sector->GetTexture(sector_t::floor) == skyflatnum || sector_t *sector = origin->Sector;
origin->Sector->GetTexture(sector_t::ceiling) == skyflatnum) if (sector->GetTexture(sector_t::floor) == skyflatnum ||
sector->GetTexture(sector_t::ceiling) == skyflatnum)
{ {
GLSkyInfo skyinfo; GLSkyInfo skyinfo;
skyinfo.init(origin->Sector->sky, 0); skyinfo.init(sector->sky, 0);
GLSkyPortal sky(&skyinfo, true); GLSkyPortal sky(&skyinfo, true);
sky.DrawContents(); sky.DrawContents();
} }
if (origin->Sector->GetTexture(sector_t::ceiling) != skyflatnum) if (sector->GetTexture(sector_t::ceiling) != skyflatnum)
{ {
GLHorizonInfo horz; GLHorizonInfo horz;
horz.plane.GetFromSector(origin->Sector, true); horz.plane.GetFromSector(sector, true);
horz.lightlevel = gl_ClampLight(origin->Sector->GetCeilingLight()); horz.lightlevel = gl_ClampLight(sector->GetCeilingLight());
horz.colormap = origin->Sector->ColorMap; horz.colormap = sector->ColorMap;
if (origin->special1 == SKYBOX_PLANE) if (origin->special1 == SKYBOX_PLANE)
{ {
horz.plane.Texheight = ViewPos.Z + fabs(horz.plane.Texheight); horz.plane.Texheight = ViewPos.Z + fabs(horz.plane.Texheight);
@ -1201,12 +1202,12 @@ void GLEEHorizonPortal::DrawContents()
GLHorizonPortal ceil(&horz, true); GLHorizonPortal ceil(&horz, true);
ceil.DrawContents(); ceil.DrawContents();
} }
if (origin->Sector->GetTexture(sector_t::floor) != skyflatnum) if (sector->GetTexture(sector_t::floor) != skyflatnum)
{ {
GLHorizonInfo horz; GLHorizonInfo horz;
horz.plane.GetFromSector(origin->Sector, false); horz.plane.GetFromSector(sector, false);
horz.lightlevel = gl_ClampLight(origin->Sector->GetFloorLight()); horz.lightlevel = gl_ClampLight(sector->GetFloorLight());
horz.colormap = origin->Sector->ColorMap; horz.colormap = sector->ColorMap;
if (origin->special1 == SKYBOX_PLANE) if (origin->special1 == SKYBOX_PLANE)
{ {
horz.plane.Texheight = ViewPos.Z - fabs(horz.plane.Texheight); horz.plane.Texheight = ViewPos.Z - fabs(horz.plane.Texheight);

View file

@ -669,7 +669,6 @@ void FDrawInfo::DrawUnhandledMissingTextures()
if (seg->linedef->validcount == validcount) continue; // already done if (seg->linedef->validcount == validcount) continue; // already done
seg->linedef->validcount = validcount; seg->linedef->validcount = validcount;
if (seg->frontsector->GetPlaneTexZF(sector_t::ceiling) < ViewPos.Z) continue; // out of sight if (seg->frontsector->GetPlaneTexZF(sector_t::ceiling) < ViewPos.Z) continue; // out of sight
//if (seg->frontsector->ceilingpic==skyflatnum) continue;
// FIXME: The check for degenerate subsectors should be more precise // FIXME: The check for degenerate subsectors should be more precise
if (seg->PartnerSeg && (seg->PartnerSeg->Subsector->flags & SSECF_DEGENERATE)) continue; if (seg->PartnerSeg && (seg->PartnerSeg->Subsector->flags & SSECF_DEGENERATE)) continue;
@ -688,7 +687,6 @@ void FDrawInfo::DrawUnhandledMissingTextures()
seg_t * seg = MissingLowerSegs[i].seg; seg_t * seg = MissingLowerSegs[i].seg;
// already done!
if (seg->linedef->validcount == validcount) continue; // already done if (seg->linedef->validcount == validcount) continue; // already done
seg->linedef->validcount = validcount; seg->linedef->validcount = validcount;
if (!(sectorrenderflags[seg->backsector->sectornum] & SSRF_RENDERFLOOR)) continue; if (!(sectorrenderflags[seg->backsector->sectornum] & SSRF_RENDERFLOOR)) continue;
@ -1049,7 +1047,7 @@ void FDrawInfo::CollectSectorStacksCeiling(subsector_t * sub, sector_t * anchor)
sub->validcount=validcount; sub->validcount=validcount;
// Has a sector stack or skybox itself! // Has a sector stack or skybox itself!
if (sub->render_sector->portals[sector_t::ceiling] != NULL) return; if (sub->render_sector->GetGLPortal(sector_t::ceiling) != nullptr) return;
// Don't bother processing unrendered subsectors // Don't bother processing unrendered subsectors
if (sub->numlines>2 && !(ss_renderflags[DWORD(sub-subsectors)]&SSRF_PROCESSED)) return; if (sub->numlines>2 && !(ss_renderflags[DWORD(sub-subsectors)]&SSRF_PROCESSED)) return;
@ -1096,7 +1094,7 @@ void FDrawInfo::CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor)
sub->validcount=validcount; sub->validcount=validcount;
// Has a sector stack or skybox itself! // Has a sector stack or skybox itself!
if (sub->render_sector->portals[sector_t::floor] != NULL) return; if (sub->render_sector->GetGLPortal(sector_t::floor) != nullptr) return;
// Don't bother processing unrendered subsectors // Don't bother processing unrendered subsectors
if (sub->numlines>2 && !(ss_renderflags[DWORD(sub-subsectors)]&SSRF_PROCESSED)) return; if (sub->numlines>2 && !(ss_renderflags[DWORD(sub-subsectors)]&SSRF_PROCESSED)) return;
@ -1146,7 +1144,7 @@ void FDrawInfo::ProcessSectorStacks()
for (i=0;i<CeilingStacks.Size (); i++) for (i=0;i<CeilingStacks.Size (); i++)
{ {
sector_t *sec = gl_FakeFlat(CeilingStacks[i], &fake, false); sector_t *sec = gl_FakeFlat(CeilingStacks[i], &fake, false);
FPortal *portal = sec->portals[sector_t::ceiling]; FPortal *portal = sec->GetGLPortal(sector_t::ceiling);
if (portal != NULL) for(int k=0;k<sec->subsectorcount;k++) if (portal != NULL) for(int k=0;k<sec->subsectorcount;k++)
{ {
subsector_t * sub = sec->subsectors[k]; subsector_t * sub = sec->subsectors[k];
@ -1170,10 +1168,10 @@ void FDrawInfo::ProcessSectorStacks()
if (sub->portalcoverage[sector_t::ceiling].subsectors == NULL) if (sub->portalcoverage[sector_t::ceiling].subsectors == NULL)
{ {
gl_BuildPortalCoverage(&sub->portalcoverage[sector_t::ceiling], sub, portal); gl_BuildPortalCoverage(&sub->portalcoverage[sector_t::ceiling], sub, portal->mDisplacement);
} }
portal->GetGLPortal()->AddSubsector(sub); portal->GetRenderState()->AddSubsector(sub);
if (sec->GetAlpha(sector_t::ceiling) != 0 && sec->GetTexture(sector_t::ceiling) != skyflatnum) if (sec->GetAlpha(sector_t::ceiling) != 0 && sec->GetTexture(sector_t::ceiling) != skyflatnum)
{ {
@ -1190,7 +1188,7 @@ void FDrawInfo::ProcessSectorStacks()
for (i=0;i<FloorStacks.Size (); i++) for (i=0;i<FloorStacks.Size (); i++)
{ {
sector_t *sec = gl_FakeFlat(FloorStacks[i], &fake, false); sector_t *sec = gl_FakeFlat(FloorStacks[i], &fake, false);
FPortal *portal = sec->portals[sector_t::floor]; FPortal *portal = sec->GetGLPortal(sector_t::floor);
if (portal != NULL) for(int k=0;k<sec->subsectorcount;k++) if (portal != NULL) for(int k=0;k<sec->subsectorcount;k++)
{ {
subsector_t * sub = sec->subsectors[k]; subsector_t * sub = sec->subsectors[k];
@ -1215,10 +1213,10 @@ void FDrawInfo::ProcessSectorStacks()
if (sub->portalcoverage[sector_t::floor].subsectors == NULL) if (sub->portalcoverage[sector_t::floor].subsectors == NULL)
{ {
gl_BuildPortalCoverage(&sub->portalcoverage[sector_t::floor], sub, portal); gl_BuildPortalCoverage(&sub->portalcoverage[sector_t::floor], sub, portal->mDisplacement);
} }
GLSectorStackPortal *glportal = portal->GetGLPortal(); GLSectorStackPortal *glportal = portal->GetRenderState();
glportal->AddSubsector(sub); glportal->AddSubsector(sub);
if (sec->GetAlpha(sector_t::floor) != 0 && sec->GetTexture(sector_t::floor) != skyflatnum) if (sec->GetAlpha(sector_t::floor) != 0 && sec->GetTexture(sector_t::floor) != skyflatnum)

View file

@ -311,10 +311,14 @@ void GLWall::SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex
} }
else else
{ {
FPortal *pfront = fs->portals[sector_t::ceiling]; int type = fs->GetPortalType(sector_t::ceiling);
FPortal *pback = bs->portals[sector_t::ceiling]; if (type == SKYBOX_STACKEDSECTORTHING || type == SKYBOX_PORTAL || type == SKYBOX_LINKEDPORTAL)
if (pfront == NULL || fs->PortalBlocksView(sector_t::ceiling)) return; {
if (pfront == pback && !bs->PortalBlocksView(sector_t::ceiling)) return; FPortal *pfront = fs->GetGLPortal(sector_t::ceiling);
FPortal *pback = bs->GetGLPortal(sector_t::ceiling);
if (pfront == NULL || fs->PortalBlocksView(sector_t::ceiling)) return;
if (pfront == pback && !bs->PortalBlocksView(sector_t::ceiling)) return;
}
} }
// stacked sectors // stacked sectors
@ -386,10 +390,14 @@ void GLWall::SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,ver
} }
else else
{ {
FPortal *pfront = fs->portals[sector_t::floor]; int type = fs->GetPortalType(sector_t::floor);
FPortal *pback = bs->portals[sector_t::floor]; if (type == SKYBOX_STACKEDSECTORTHING || type == SKYBOX_PORTAL || type == SKYBOX_LINKEDPORTAL)
if (pfront == NULL || fs->PortalBlocksView(sector_t::floor)) return; {
if (pfront == pback && !bs->PortalBlocksView(sector_t::floor)) return; FPortal *pfront = fs->GetGLPortal(sector_t::floor);
FPortal *pback = bs->GetGLPortal(sector_t::floor);
if (pfront == NULL || fs->PortalBlocksView(sector_t::floor)) return;
if (pfront == pback && !bs->PortalBlocksView(sector_t::floor)) return;
}
} }
// stacked sectors // stacked sectors

View file

@ -554,8 +554,8 @@ void GLSprite::Process(AActor* thing, sector_t * sector, bool thruportal)
{ {
rendersector = sector; rendersector = sector;
} }
topclip = rendersector->PortalBlocksMovement(sector_t::ceiling) ? LARGE_VALUE : rendersector->SkyBoxes[sector_t::ceiling]->specialf1; topclip = rendersector->PortalBlocksMovement(sector_t::ceiling) ? LARGE_VALUE : rendersector->GetPortalPlaneZ(sector_t::ceiling);
bottomclip = rendersector->PortalBlocksMovement(sector_t::floor) ? -LARGE_VALUE : rendersector->SkyBoxes[sector_t::floor]->specialf1; bottomclip = rendersector->PortalBlocksMovement(sector_t::floor) ? -LARGE_VALUE : rendersector->GetPortalPlaneZ(sector_t::floor);
x = thingpos.X; x = thingpos.X;

View file

@ -185,7 +185,7 @@ void GLWall::PutPortal(int ptype)
break; break;
case PORTALTYPE_SECTORSTACK: case PORTALTYPE_SECTORSTACK:
portal = this->portal->GetGLPortal(); portal = this->portal->GetRenderState();
portal->AddLine(this); portal->AddLine(this);
break; break;

View file

@ -38,6 +38,7 @@
#include "actor.h" #include "actor.h"
struct FLightNode; struct FLightNode;
struct FGLSection; struct FGLSection;
struct FPortal;
struct seg_t; struct seg_t;
#include "dthinker.h" #include "dthinker.h"
@ -499,7 +500,6 @@ struct subsector_t;
struct sector_t; struct sector_t;
struct side_t; struct side_t;
extern bool gl_plane_reflection_i; extern bool gl_plane_reflection_i;
struct FPortal;
// Ceiling/floor flags // Ceiling/floor flags
enum enum
@ -1159,6 +1159,8 @@ public:
float GetReflect(int pos) { return gl_plane_reflection_i? reflect[pos] : 0; } float GetReflect(int pos) { return gl_plane_reflection_i? reflect[pos] : 0; }
bool VBOHeightcheck(int pos) const { return vboheight[pos] == GetPlaneTexZ(pos); } bool VBOHeightcheck(int pos) const { return vboheight[pos] == GetPlaneTexZ(pos); }
FPortal *GetGLPortal(int plane) { return portals[plane]; }
void ClearPortal(int plane) { portals[plane] = nullptr; SkyBoxes[plane] = nullptr; }
enum enum
{ {