From 60ebd71feaaae70a93f08fc8231691588f68bc48 Mon Sep 17 00:00:00 2001 From: "Dileep V. Reddy" Date: Fri, 7 Mar 2025 23:47:12 -0700 Subject: [PATCH] Handle sectors within sectors for stacked portals and plane mirrors (affects OoB only). --- src/rendering/hwrenderer/scene/hw_portal.cpp | 10 ++++++---- src/rendering/hwrenderer/scene/hw_sky.cpp | 10 ++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/rendering/hwrenderer/scene/hw_portal.cpp b/src/rendering/hwrenderer/scene/hw_portal.cpp index 965582a2e6..cc7289480f 100644 --- a/src/rendering/hwrenderer/scene/hw_portal.cpp +++ b/src/rendering/hwrenderer/scene/hw_portal.cpp @@ -815,6 +815,7 @@ bool HWSectorStackPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *c if (origin->plane != -1) screen->instack[origin->plane]++; if (lines.Size() > 0) { + flat.plane.GetFromSector(lines[0].sub->sector, origin->plane); di->SetClipHeight(flat.plane.plane.ZatPoint(vp.Pos), flat.plane.plane.Normal().Z > 0 ? -1.f : 1.f); @@ -841,11 +842,12 @@ void HWSectorStackPortal::DrawPortalStencil(FRenderState &state, int pass) if (mState->vpIsAllowedOoB) { bool isceiling = planesused & (1 << sector_t::ceiling); - for (unsigned int i = 0; i < lines.Size(); i++) + for (unsigned i = 0; isection; - flat.iboindex = lines[i].sub->sector->iboindex[isceiling ? sector_t::ceiling : sector_t::floor]; - flat.plane.GetFromSector(lines[i].sub->sector, isceiling ? sector_t::ceiling : sector_t::floor); + subsector_t *sub = subsectors[i]; + flat.section = sub->section; + flat.iboindex = sub->sector->iboindex[isceiling ? sector_t::ceiling : sector_t::floor]; + flat.plane.GetFromSector(sub->sector, isceiling ? sector_t::ceiling : sector_t::floor); // if (isceiling) flat.plane.plane.FlipVert(); // Doesn't do anything. Stencil is a screen-space projection state.SetNormal(flat.plane.plane.Normal().X, flat.plane.plane.Normal().Z, flat.plane.plane.Normal().Y); diff --git a/src/rendering/hwrenderer/scene/hw_sky.cpp b/src/rendering/hwrenderer/scene/hw_sky.cpp index 2aef16c8f0..ce89b545a6 100644 --- a/src/rendering/hwrenderer/scene/hw_sky.cpp +++ b/src/rendering/hwrenderer/scene/hw_sky.cpp @@ -319,7 +319,10 @@ void HWWall::SkyTop(HWWallDispatcher *di, seg_t * seg,sector_t * fs,sector_t * b if (backreflect > 0 && bs->ceilingplane.fD() == fs->ceilingplane.fD() && !bs->isClosed()) { // Don't add intra-portal line to the portal. - return; + if (!(di->di && di->di->Viewpoint.IsAllowedOoB())) + { + return; + } } } else @@ -398,7 +401,10 @@ void HWWall::SkyBottom(HWWallDispatcher *di, seg_t * seg,sector_t * fs,sector_t if (backreflect > 0 && bs->floorplane.fD() == fs->floorplane.fD() && !bs->isClosed()) { // Don't add intra-portal line to the portal. - return; + if (!(di->di && di->di->Viewpoint.IsAllowedOoB())) + { + return; + } } } else