- Simplify the portal code in softpoly somewhat
This commit is contained in:
parent
b0261d9545
commit
16a8d71caf
15 changed files with 138 additions and 259 deletions
|
|
@ -40,7 +40,7 @@
|
|||
EXTERN_CVAR(Bool, r_drawmirrors)
|
||||
EXTERN_CVAR(Bool, r_fogboundary)
|
||||
|
||||
bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const PolyClipPlane &clipPlane, seg_t *line, sector_t *frontsector, uint32_t subsectorDepth, uint32_t stencilValue, std::vector<PolyTranslucentObject*> &translucentWallsOutput, std::vector<std::unique_ptr<PolyDrawLinePortal>> &linePortals, line_t *lastPortalLine)
|
||||
bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const PolyClipPlane &clipPlane, seg_t *line, sector_t *frontsector, uint32_t subsectorDepth, uint32_t stencilValue, std::vector<PolyTranslucentObject*> &translucentWallsOutput, std::vector<std::unique_ptr<PolyDrawLinePortal>> &linePortals, size_t linePortalsStart, line_t *portalEnterLine)
|
||||
{
|
||||
double frontceilz1 = frontsector->ceilingplane.ZatPoint(line->v1);
|
||||
double frontfloorz1 = frontsector->floorplane.ZatPoint(line->v1);
|
||||
|
|
@ -52,7 +52,7 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const PolyClipPlane &c
|
|||
PolyDrawLinePortal *polyportal = nullptr;
|
||||
if (line->backsector == nullptr && line->linedef && line->sidedef == line->linedef->sidedef[0] && (line->linedef->special == Line_Mirror && r_drawmirrors))
|
||||
{
|
||||
if (lastPortalLine == line->linedef ||
|
||||
if (portalEnterLine == line->linedef ||
|
||||
(line->linedef->v1->fX() * clipPlane.A + line->linedef->v1->fY() * clipPlane.B + clipPlane.D <= 0.0f) ||
|
||||
(line->linedef->v2->fX() * clipPlane.A + line->linedef->v2->fY() * clipPlane.B + clipPlane.D <= 0.0f))
|
||||
{
|
||||
|
|
@ -64,7 +64,7 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const PolyClipPlane &c
|
|||
}
|
||||
else if (line->linedef && line->linedef->isVisualPortal())
|
||||
{
|
||||
if (lastPortalLine == line->linedef ||
|
||||
if (portalEnterLine == line->linedef ||
|
||||
(line->linedef->v1->fX() * clipPlane.A + line->linedef->v1->fY() * clipPlane.B + clipPlane.D <= 0.0f) ||
|
||||
(line->linedef->v2->fX() * clipPlane.A + line->linedef->v2->fY() * clipPlane.B + clipPlane.D <= 0.0f))
|
||||
{
|
||||
|
|
@ -72,11 +72,11 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const PolyClipPlane &c
|
|||
}
|
||||
|
||||
FLinePortal *portal = line->linedef->getPortal();
|
||||
for (auto &p : linePortals)
|
||||
for (size_t i = linePortalsStart; i < linePortals.size(); i++)
|
||||
{
|
||||
if (p->Portal == portal) // To do: what other criterias do we need to check for?
|
||||
if (linePortals[i]->Portal == portal) // To do: what other criteria do we need to check for?
|
||||
{
|
||||
polyportal = p.get();
|
||||
polyportal = linePortals[i].get();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -322,7 +322,6 @@ void RenderPolyWall::Render(PolyRenderThread *thread, const PolyClipPlane &clipP
|
|||
|
||||
PolyDrawArgs args;
|
||||
args.SetLight(Colormap, GetLightLevel(), PolyRenderer::Instance()->Light.WallGlobVis(foggy), false);
|
||||
args.SetStencilTestValue(StencilValue);
|
||||
if (Texture && !Polyportal)
|
||||
args.SetTexture(Texture, DefaultRenderStyle());
|
||||
args.SetClipPlane(0, clipPlane);
|
||||
|
|
@ -331,6 +330,7 @@ void RenderPolyWall::Render(PolyRenderThread *thread, const PolyClipPlane &clipP
|
|||
|
||||
if (FogBoundary)
|
||||
{
|
||||
args.SetStencilTestValue(StencilValue + 1);
|
||||
args.SetStyle(TriBlendMode::FogBoundary);
|
||||
args.SetColor(0xffffffff, 254);
|
||||
args.SetDepthTest(true);
|
||||
|
|
@ -343,6 +343,7 @@ void RenderPolyWall::Render(PolyRenderThread *thread, const PolyClipPlane &clipP
|
|||
|
||||
if (Polyportal)
|
||||
{
|
||||
args.SetStencilTestValue(StencilValue);
|
||||
args.SetWriteStencil(true, Polyportal->StencilValue);
|
||||
args.SetWriteColor(false);
|
||||
args.SetWriteDepth(false);
|
||||
|
|
@ -351,6 +352,7 @@ void RenderPolyWall::Render(PolyRenderThread *thread, const PolyClipPlane &clipP
|
|||
}
|
||||
else if (!Masked)
|
||||
{
|
||||
args.SetStencilTestValue(StencilValue);
|
||||
args.SetWriteStencil(true, StencilValue + 1);
|
||||
args.SetStyle(TriBlendMode::TextureOpaque);
|
||||
DrawStripes(thread, args, vertices);
|
||||
|
|
@ -360,13 +362,14 @@ void RenderPolyWall::Render(PolyRenderThread *thread, const PolyClipPlane &clipP
|
|||
double srcalpha = MIN(Alpha, 1.0);
|
||||
double destalpha = Additive ? 1.0 : 1.0 - srcalpha;
|
||||
args.SetStyle(TriBlendMode::TextureAdd, srcalpha, destalpha);
|
||||
args.SetStencilTestValue(StencilValue + 1);
|
||||
args.SetDepthTest(true);
|
||||
args.SetWriteDepth(true);
|
||||
args.SetWriteStencil(false);
|
||||
DrawStripes(thread, args, vertices);
|
||||
}
|
||||
|
||||
RenderPolyDecal::RenderWallDecals(thread, clipPlane, LineSeg, StencilValue);
|
||||
RenderPolyDecal::RenderWallDecals(thread, clipPlane, LineSeg, StencilValue + 1);
|
||||
}
|
||||
|
||||
void RenderPolyWall::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue