mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-28 14:52:01 +00:00
Only render line portals once
This commit is contained in:
parent
40b68bfea0
commit
a1bb6e6b23
3 changed files with 35 additions and 11 deletions
|
@ -117,6 +117,8 @@ void PolyRenderer::ClearBuffers()
|
||||||
PolyStencilBuffer::Instance()->Clear(RenderTarget->GetWidth(), RenderTarget->GetHeight(), 0);
|
PolyStencilBuffer::Instance()->Clear(RenderTarget->GetWidth(), RenderTarget->GetHeight(), 0);
|
||||||
PolySubsectorGBuffer::Instance()->Resize(RenderTarget->GetPitch(), RenderTarget->GetHeight());
|
PolySubsectorGBuffer::Instance()->Resize(RenderTarget->GetPitch(), RenderTarget->GetHeight());
|
||||||
NextStencilValue = 0;
|
NextStencilValue = 0;
|
||||||
|
SeenLinePortals.clear();
|
||||||
|
SeenMirrors.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyRenderer::SetSceneViewport()
|
void PolyRenderer::SetSceneViewport()
|
||||||
|
@ -170,3 +172,13 @@ void PolyRenderer::SetupPerspectiveMatrix()
|
||||||
|
|
||||||
WorldToClip = TriMatrix::perspective(fovy, ratio, 5.0f, 65535.0f) * worldToView;
|
WorldToClip = TriMatrix::perspective(fovy, ratio, 5.0f, 65535.0f) * worldToView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PolyRenderer::InsertSeenLinePortal(FLinePortal *portal)
|
||||||
|
{
|
||||||
|
return SeenLinePortals.insert(portal).second;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PolyRenderer::InsertSeenMirror(line_t *mirrorLine)
|
||||||
|
{
|
||||||
|
return SeenMirrors.insert(mirrorLine).second;
|
||||||
|
}
|
||||||
|
|
|
@ -47,6 +47,9 @@ public:
|
||||||
|
|
||||||
uint32_t GetNextStencilValue() { uint32_t value = NextStencilValue; NextStencilValue += 2; return value; }
|
uint32_t GetNextStencilValue() { uint32_t value = NextStencilValue; NextStencilValue += 2; return value; }
|
||||||
|
|
||||||
|
bool InsertSeenLinePortal(FLinePortal *portal);
|
||||||
|
bool InsertSeenMirror(line_t *mirrorLine);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ClearBuffers();
|
void ClearBuffers();
|
||||||
void SetSceneViewport();
|
void SetSceneViewport();
|
||||||
|
@ -57,4 +60,7 @@ private:
|
||||||
PolySkyDome Skydome;
|
PolySkyDome Skydome;
|
||||||
RenderPolyPlayerSprites PlayerSprites;
|
RenderPolyPlayerSprites PlayerSprites;
|
||||||
uint32_t NextStencilValue = 0;
|
uint32_t NextStencilValue = 0;
|
||||||
|
|
||||||
|
std::set<FLinePortal *> SeenLinePortals;
|
||||||
|
std::set<line_t *> SeenMirrors;
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,13 +39,18 @@ bool RenderPolyWall::RenderLine(const TriMatrix &worldToClip, const Vec4f &clipP
|
||||||
{
|
{
|
||||||
PolyDrawLinePortal *polyportal = nullptr;
|
PolyDrawLinePortal *polyportal = nullptr;
|
||||||
if (line->backsector == nullptr && line->linedef && line->sidedef == line->linedef->sidedef[0] && (line->linedef->special == Line_Mirror && r_drawmirrors))
|
if (line->backsector == nullptr && line->linedef && line->sidedef == line->linedef->sidedef[0] && (line->linedef->special == Line_Mirror && r_drawmirrors))
|
||||||
|
{
|
||||||
|
if (PolyRenderer::Instance()->InsertSeenMirror(line->linedef))
|
||||||
{
|
{
|
||||||
linePortals.push_back(std::make_unique<PolyDrawLinePortal>(line->linedef));
|
linePortals.push_back(std::make_unique<PolyDrawLinePortal>(line->linedef));
|
||||||
polyportal = linePortals.back().get();
|
polyportal = linePortals.back().get();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (line->linedef && line->linedef->isVisualPortal())
|
else if (line->linedef && line->linedef->isVisualPortal())
|
||||||
{
|
{
|
||||||
FLinePortal *portal = line->linedef->getPortal();
|
FLinePortal *portal = line->linedef->getPortal();
|
||||||
|
if (PolyRenderer::Instance()->InsertSeenLinePortal(portal))
|
||||||
|
{
|
||||||
for (auto &p : linePortals)
|
for (auto &p : linePortals)
|
||||||
{
|
{
|
||||||
if (p->Portal == portal) // To do: what other criterias do we need to check for?
|
if (p->Portal == portal) // To do: what other criterias do we need to check for?
|
||||||
|
@ -60,6 +65,7 @@ bool RenderPolyWall::RenderLine(const TriMatrix &worldToClip, const Vec4f &clipP
|
||||||
polyportal = linePortals.back().get();
|
polyportal = linePortals.back().get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RenderPolyWall wall;
|
RenderPolyWall wall;
|
||||||
wall.LineSeg = line;
|
wall.LineSeg = line;
|
||||||
|
|
Loading…
Reference in a new issue