diff --git a/src/hwrenderer/scene/hw_bsp.cpp b/src/hwrenderer/scene/hw_bsp.cpp index 075a93d8f..31a3694ee 100644 --- a/src/hwrenderer/scene/hw_bsp.cpp +++ b/src/hwrenderer/scene/hw_bsp.cpp @@ -702,6 +702,21 @@ void HWDrawInfo::DoSubsector(subsector_t * sub) ss_renderflags[sub->Index()] = (sub->numlines > 2) ? SSRF_PROCESSED|SSRF_RENDERALL : SSRF_PROCESSED; if (sub->hacked & 1) AddHackedSubsector(sub); + + // This is for portal coverage. + FSectorPortalGroup *portal; + + portal = fakesector->GetPortalGroup(sector_t::ceiling); + if (portal != nullptr) + { + AddSubsectorToPortal(portal, sub); + } + + portal = fakesector->GetPortalGroup(sector_t::floor); + if (portal != nullptr) + { + AddSubsectorToPortal(portal, sub); + } } } } diff --git a/src/hwrenderer/scene/hw_drawinfo.cpp b/src/hwrenderer/scene/hw_drawinfo.cpp index 40bdb8a7a..803b70c12 100644 --- a/src/hwrenderer/scene/hw_drawinfo.cpp +++ b/src/hwrenderer/scene/hw_drawinfo.cpp @@ -655,3 +655,22 @@ void HWDrawInfo::ProcessScene(bool toscreen, const std::functionmPortalState, new HWSectorStackPortal(ptg)); + Portals.Push(portal); + } + auto ptl = static_cast(static_cast(portal)->mScene); + ptl->AddSubsector(sub); +} + diff --git a/src/hwrenderer/scene/hw_drawinfo.h b/src/hwrenderer/scene/hw_drawinfo.h index 33074b0fd..6fc0e212f 100644 --- a/src/hwrenderer/scene/hw_drawinfo.h +++ b/src/hwrenderer/scene/hw_drawinfo.h @@ -300,6 +300,7 @@ public: void DrawPlayerSprites(bool hudModelStep, FRenderState &state); void ProcessLowerMinisegs(TArray &lowersegs); + void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub); void AddWall(GLWall *w); void AddMirrorSurface(GLWall *w); diff --git a/src/hwrenderer/scene/hw_renderhacks.cpp b/src/hwrenderer/scene/hw_renderhacks.cpp index 1558b4bba..5592a03ab 100644 --- a/src/hwrenderer/scene/hw_renderhacks.cpp +++ b/src/hwrenderer/scene/hw_renderhacks.cpp @@ -1393,22 +1393,4 @@ void HWDrawInfo::ProcessSectorStacks(area_t in_area) CeilingStacks.Clear(); } -//========================================================================== -// -// -// -//========================================================================== - -void HWDrawInfo::AddSubsectorToPortal(FSectorPortalGroup *ptg, subsector_t *sub) -{ - auto portal = FindPortal(ptg); - if (!portal) - { - portal = new HWScenePortal(screen->mPortalState, new HWSectorStackPortal(ptg)); - Portals.Push(portal); - } - auto ptl = static_cast(static_cast(portal)->mScene); - ptl->AddSubsector(sub); -} - #endif