mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- slightly improve sector portal handling in softpoly
This commit is contained in:
parent
6e77cb4906
commit
2aee68d215
5 changed files with 15 additions and 3 deletions
|
@ -28,7 +28,7 @@
|
|||
#include "poly_cull.h"
|
||||
#include "polyrenderer/poly_renderer.h"
|
||||
|
||||
void PolyCull::CullScene(const PolyClipPlane &portalClipPlane)
|
||||
void PolyCull::CullScene(const PolyClipPlane &portalClipPlane, sector_t *portalEnter)
|
||||
{
|
||||
ClearSolidSegments();
|
||||
MarkViewFrustum();
|
||||
|
@ -49,6 +49,7 @@ void PolyCull::CullScene(const PolyClipPlane &portalClipPlane)
|
|||
PvsLineVisible.resize(level.segs.Size());
|
||||
|
||||
PortalClipPlane = portalClipPlane;
|
||||
PortalEnter = portalEnter;
|
||||
|
||||
// Cull front to back
|
||||
FirstSkyHeight = true;
|
||||
|
@ -87,6 +88,14 @@ void PolyCull::CullNode(void *node)
|
|||
|
||||
void PolyCull::CullSubsector(subsector_t *sub)
|
||||
{
|
||||
// Ignore everything in front of the portal
|
||||
if (PortalEnter)
|
||||
{
|
||||
if (sub->sector != PortalEnter)
|
||||
return;
|
||||
PortalEnter = nullptr;
|
||||
}
|
||||
|
||||
// Check if subsector is clipped entirely by the portal clip plane
|
||||
bool visible = false;
|
||||
for (uint32_t i = 0; i < sub->numlines; i++)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
class PolyCull
|
||||
{
|
||||
public:
|
||||
void CullScene(const PolyClipPlane &portalClipPlane);
|
||||
void CullScene(const PolyClipPlane &portalClipPlane, sector_t *portalEnter);
|
||||
|
||||
bool IsLineSegVisible(uint32_t subsectorDepth, uint32_t lineIndex)
|
||||
{
|
||||
|
@ -78,6 +78,7 @@ private:
|
|||
bool FirstSkyHeight = true;
|
||||
|
||||
PolyClipPlane PortalClipPlane;
|
||||
sector_t *PortalEnter = nullptr;
|
||||
|
||||
std::vector<uint32_t> PvsLineStart;
|
||||
std::vector<bool> PvsLineVisible;
|
||||
|
|
|
@ -50,6 +50,7 @@ void PolyDrawSectorPortal::Render(int portalDepth)
|
|||
PortalViewpoint.StencilValue = StencilValue;
|
||||
PortalViewpoint.PortalPlane = PolyClipPlane(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
PortalViewpoint.PortalDepth = portalDepth;
|
||||
PortalViewpoint.PortalEnterSector = Portal->mDestination;
|
||||
|
||||
PolyRenderer::Instance()->Scene.Render(&PortalViewpoint);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ void RenderPolyScene::Render(PolyPortalViewpoint *viewpoint)
|
|||
CurrentViewpoint->LinePortalsStart = thread->LinePortals.size();
|
||||
|
||||
PolyCullCycles.Clock();
|
||||
Cull.CullScene(CurrentViewpoint->PortalPlane);
|
||||
Cull.CullScene(CurrentViewpoint->PortalPlane, CurrentViewpoint->PortalEnterSector);
|
||||
PolyCullCycles.Unclock();
|
||||
|
||||
RenderSectors();
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
bool Mirror = false;
|
||||
|
||||
line_t *PortalEnterLine = nullptr;
|
||||
sector_t *PortalEnterSector = nullptr;
|
||||
|
||||
size_t ObjectsStart = 0;
|
||||
size_t ObjectsEnd = 0;
|
||||
|
|
Loading…
Reference in a new issue