- fix softpoly line portals

This commit is contained in:
Magnus Norddahl 2018-04-23 23:09:11 +02:00
parent c264ff05da
commit 45625399dc
22 changed files with 134 additions and 171 deletions

View File

@ -161,7 +161,6 @@ void PolyRenderer::RenderActorView(AActor *actor, bool dontmaplines)
PolyPortalViewpoint mainViewpoint = SetupPerspectiveMatrix();
mainViewpoint.StencilValue = GetNextStencilValue();
mainViewpoint.PortalPlane = PolyClipPlane(0.0f, 0.0f, 0.0f, 1.0f);
Scene.CurrentViewpoint = &mainViewpoint;
Scene.Render(&mainViewpoint);
PlayerSprites.Render(Threads.MainThread());

View File

@ -28,11 +28,8 @@
#include "poly_cull.h"
#include "polyrenderer/poly_renderer.h"
void PolyCull::CullScene(const PolyClipPlane &portalClipPlane, sector_t *portalEnter)
void PolyCull::CullScene(sector_t *portalSector, line_t *portalLine)
{
ClearSolidSegments();
MarkViewFrustum();
for (uint32_t sub : PvsSubsectors)
SubsectorDepths[sub] = 0xffffffff;
SubsectorDepths.resize(level.subsectors.Size(), 0xffffffff);
@ -48,8 +45,34 @@ void PolyCull::CullScene(const PolyClipPlane &portalClipPlane, sector_t *portalE
PvsLineStart.clear();
PvsLineVisible.resize(level.segs.Size());
PortalClipPlane = portalClipPlane;
PortalEnter = portalEnter;
PortalSector = portalSector;
PortalLine = portalLine;
SolidSegments.clear();
if (portalLine)
{
DVector3 viewpos = PolyRenderer::Instance()->Viewpoint.Pos;
DVector2 pt1 = portalLine->v1->fPos() - viewpos;
DVector2 pt2 = portalLine->v2->fPos() - viewpos;
if (pt1.Y * (pt1.X - pt2.X) + pt1.X * (pt2.Y - pt1.Y) >= 0)
{
angle_t angle1 = PointToPseudoAngle(portalLine->v1->fX(), portalLine->v1->fY());
angle_t angle2 = PointToPseudoAngle(portalLine->v2->fX(), portalLine->v2->fY());
MarkSegmentCulled(angle1, angle2);
}
else
{
angle_t angle2 = PointToPseudoAngle(portalLine->v1->fX(), portalLine->v1->fY());
angle_t angle1 = PointToPseudoAngle(portalLine->v2->fX(), portalLine->v2->fY());
MarkSegmentCulled(angle1, angle2);
}
InvertSegments();
}
else
{
MarkViewFrustum();
}
// Cull front to back
FirstSkyHeight = true;
@ -89,27 +112,13 @@ void PolyCull::CullNode(void *node)
void PolyCull::CullSubsector(subsector_t *sub)
{
// Ignore everything in front of the portal
if (PortalEnter)
if (PortalSector)
{
if (sub->sector != PortalEnter)
if (sub->sector != PortalSector)
return;
PortalEnter = nullptr;
PortalSector = nullptr;
}
// Check if subsector is clipped entirely by the portal clip plane
bool visible = false;
for (uint32_t i = 0; i < sub->numlines; i++)
{
seg_t *line = &sub->firstline[i];
if (PortalClipPlane.A * line->v1->fX() + PortalClipPlane.B * line->v1->fY() + PortalClipPlane.D > 0.0)
{
visible = true;
break;
}
}
if (!visible)
return;
// Update sky heights for the scene
if (!FirstSkyHeight)
{
@ -145,16 +154,16 @@ void PolyCull::CullSubsector(subsector_t *sub)
continue;
}
// Skip line if entirely behind portal clipping plane
if ((PortalClipPlane.A * line->v1->fX() + PortalClipPlane.B * line->v1->fY() + PortalClipPlane.D <= 0.0) &&
(PortalClipPlane.A * line->v2->fX() + PortalClipPlane.B * line->v2->fY() + PortalClipPlane.D <= 0.0))
// Do not draw the portal line
if (line->linedef == PortalLine)
{
PvsLineVisible[NextPvsLineStart++] = false;
continue;
}
angle_t angle1, angle2;
bool lineVisible = GetAnglesForLine(line->v1->fX(), line->v1->fY(), line->v2->fX(), line->v2->fY(), angle1, angle2);
angle_t angle2 = PointToPseudoAngle(line->v1->fX(), line->v1->fY());
angle_t angle1 = PointToPseudoAngle(line->v2->fX(), line->v2->fY());
bool lineVisible = !IsSegmentCulled(angle1, angle2);
if (lineVisible && line->backsector == nullptr)
{
MarkSegmentCulled(angle1, angle2);
@ -173,26 +182,6 @@ void PolyCull::CullSubsector(subsector_t *sub)
SubsectorDepths[sub->Index()] = subsectorDepth;
}
void PolyCull::ClearSolidSegments()
{
SolidSegments.clear();
}
void PolyCull::InvertSegments()
{
TempInvertSolidSegments.swap(SolidSegments);
ClearSolidSegments();
angle_t cur = 0;
for (const auto &segment : TempInvertSolidSegments)
{
if (cur < segment.Start)
MarkSegmentCulled(cur, segment.Start - 1);
cur = segment.End + 1;
}
if (cur < ANGLE_MAX)
MarkSegmentCulled(cur, ANGLE_MAX);
}
bool PolyCull::IsSegmentCulled(angle_t startAngle, angle_t endAngle) const
{
if (startAngle > endAngle)
@ -305,11 +294,20 @@ bool PolyCull::CheckBBox(float *bspcoord)
return !IsSegmentCulled(angle2, angle1);
}
bool PolyCull::GetAnglesForLine(double x1, double y1, double x2, double y2, angle_t &angle1, angle_t &angle2) const
void PolyCull::InvertSegments()
{
angle2 = PointToPseudoAngle(x1, y1);
angle1 = PointToPseudoAngle(x2, y2);
return !IsSegmentCulled(angle1, angle2);
TempInvertSolidSegments.swap(SolidSegments);
SolidSegments.clear();
angle_t cur = 0;
for (const auto &segment : TempInvertSolidSegments)
{
if (cur < segment.Start)
MarkSegmentCulled(cur, segment.Start - 1);
if (segment.End == ANGLE_MAX)
return;
cur = segment.End + 1;
}
MarkSegmentCulled(cur, ANGLE_MAX);
}
void PolyCull::MarkViewFrustum()

View File

@ -29,7 +29,7 @@
class PolyCull
{
public:
void CullScene(const PolyClipPlane &portalClipPlane, sector_t *portalEnter);
void CullScene(sector_t *portalSector, line_t *portalLine);
bool IsLineSegVisible(uint32_t subsectorDepth, uint32_t lineIndex)
{
@ -53,13 +53,11 @@ private:
angle_t Start, End;
};
void ClearSolidSegments();
void MarkViewFrustum();
bool GetAnglesForLine(double x1, double y1, double x2, double y2, angle_t &angle1, angle_t &angle2) const;
bool IsSegmentCulled(angle_t angle1, angle_t angle2) const;
void InvertSegments();
bool IsSegmentCulled(angle_t angle1, angle_t angle2) const;
void CullNode(void *node);
void CullSubsector(subsector_t *sub);
int PointOnSide(const DVector2 &pos, const node_t *node);
@ -70,15 +68,13 @@ private:
void MarkSegmentCulled(angle_t angle1, angle_t angle2);
FString lastLevelName;
std::vector<SolidSegment> SolidSegments;
std::vector<SolidSegment> TempInvertSolidSegments;
const int SolidCullScale = 3000;
std::vector<SolidSegment> PortalVisibility;
bool FirstSkyHeight = true;
PolyClipPlane PortalClipPlane;
sector_t *PortalEnter = nullptr;
sector_t *PortalSector = nullptr;
line_t *PortalLine = nullptr;
std::vector<uint32_t> PvsLineStart;
std::vector<bool> PvsLineVisible;

View File

@ -32,7 +32,7 @@
#include "a_sharedglobal.h"
#include "swrenderer/scene/r_scene.h"
void RenderPolyDecal::RenderWallDecals(PolyRenderThread *thread, const PolyClipPlane &clipPlane, const seg_t *line, uint32_t stencilValue)
void RenderPolyDecal::RenderWallDecals(PolyRenderThread *thread, const seg_t *line, uint32_t stencilValue)
{
if (line->linedef == nullptr && line->sidedef == nullptr)
return;
@ -40,11 +40,11 @@ void RenderPolyDecal::RenderWallDecals(PolyRenderThread *thread, const PolyClipP
for (DBaseDecal *decal = line->sidedef->AttachedDecals; decal != nullptr; decal = decal->WallNext)
{
RenderPolyDecal render;
render.Render(thread, clipPlane, decal, line, stencilValue);
render.Render(thread, decal, line, stencilValue);
}
}
void RenderPolyDecal::Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane, DBaseDecal *decal, const seg_t *line, uint32_t stencilValue)
void RenderPolyDecal::Render(PolyRenderThread *thread, DBaseDecal *decal, const seg_t *line, uint32_t stencilValue)
{
if (decal->RenderFlags & RF_INVISIBLE || !viewactive || !decal->PicNum.isValid())
return;
@ -188,7 +188,6 @@ void RenderPolyDecal::Render(PolyRenderThread *thread, const PolyClipPlane &clip
args.SetColor(0xff000000 | decal->AlphaColor, decal->AlphaColor >> 24);
args.SetStyle(decal->RenderStyle, decal->Alpha, decal->AlphaColor, decal->Translation, tex, false);
args.SetStencilTestValue(stencilValue);
args.SetClipPlane(0, clipPlane);
args.SetDepthTest(true);
args.SetWriteStencil(false);
args.SetWriteDepth(false);

View File

@ -27,10 +27,10 @@
class RenderPolyDecal
{
public:
static void RenderWallDecals(PolyRenderThread *thread, const PolyClipPlane &clipPlane, const seg_t *line, uint32_t stencilValue);
static void RenderWallDecals(PolyRenderThread *thread, const seg_t *line, uint32_t stencilValue);
private:
void Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane, DBaseDecal *decal, const seg_t *line, uint32_t stencilValue);
void Render(PolyRenderThread *thread, DBaseDecal *decal, const seg_t *line, uint32_t stencilValue);
void GetDecalSectors(DBaseDecal *decal, const seg_t *line, sector_t **front, sector_t **back);
double GetDecalZ(DBaseDecal *decal, const seg_t *line, sector_t *front, sector_t *back);

View File

@ -36,21 +36,21 @@
void gl_FlushModels();
bool polymodelsInUse;
void PolyRenderModel(PolyRenderThread *thread, const Mat4f &worldToClip, const PolyClipPlane &clipPlane, uint32_t stencilValue, float x, float y, float z, FSpriteModelFrame *smf, AActor *actor)
void PolyRenderModel(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_t stencilValue, float x, float y, float z, FSpriteModelFrame *smf, AActor *actor)
{
PolyModelRenderer renderer(thread, worldToClip, clipPlane, stencilValue);
PolyModelRenderer renderer(thread, worldToClip, stencilValue);
renderer.RenderModel(x, y, z, smf, actor);
}
void PolyRenderHUDModel(PolyRenderThread *thread, const Mat4f &worldToClip, const PolyClipPlane &clipPlane, uint32_t stencilValue, DPSprite *psp, float ofsx, float ofsy)
void PolyRenderHUDModel(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_t stencilValue, DPSprite *psp, float ofsx, float ofsy)
{
PolyModelRenderer renderer(thread, worldToClip, clipPlane, stencilValue);
PolyModelRenderer renderer(thread, worldToClip, stencilValue);
renderer.RenderHUDModel(psp, ofsx, ofsy);
}
/////////////////////////////////////////////////////////////////////////////
PolyModelRenderer::PolyModelRenderer(PolyRenderThread *thread, const Mat4f &worldToClip, const PolyClipPlane &clipPlane, uint32_t stencilValue) : Thread(thread), WorldToClip(worldToClip), ClipPlane(clipPlane), StencilValue(stencilValue)
PolyModelRenderer::PolyModelRenderer(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_t stencilValue) : Thread(thread), WorldToClip(worldToClip), StencilValue(stencilValue)
{
if (!polymodelsInUse)
{

View File

@ -26,13 +26,13 @@
#include "r_data/matrix.h"
#include "r_data/models/models.h"
void PolyRenderModel(PolyRenderThread *thread, const Mat4f &worldToClip, const PolyClipPlane &clipPlane, uint32_t stencilValue, float x, float y, float z, FSpriteModelFrame *smf, AActor *actor);
void PolyRenderHUDModel(PolyRenderThread *thread, const Mat4f &worldToClip, const PolyClipPlane &clipPlane, uint32_t stencilValue, DPSprite *psp, float ofsx, float ofsy);
void PolyRenderModel(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_t stencilValue, float x, float y, float z, FSpriteModelFrame *smf, AActor *actor);
void PolyRenderHUDModel(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_t stencilValue, DPSprite *psp, float ofsx, float ofsy);
class PolyModelRenderer : public FModelRenderer
{
public:
PolyModelRenderer(PolyRenderThread *thread, const Mat4f &worldToClip, const PolyClipPlane &clipPlane, uint32_t stencilValue);
PolyModelRenderer(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_t stencilValue);
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix) override;
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
@ -52,7 +52,6 @@ public:
PolyRenderThread *Thread = nullptr;
const Mat4f &WorldToClip;
const PolyClipPlane &ClipPlane;
uint32_t StencilValue = 0;
AActor *ModelActor = nullptr;

View File

@ -32,7 +32,7 @@
EXTERN_CVAR(Int, gl_particles_style)
void RenderPolyParticle::Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane, particle_t *particle, subsector_t *sub, uint32_t stencilValue)
void RenderPolyParticle::Render(PolyRenderThread *thread, particle_t *particle, subsector_t *sub, uint32_t stencilValue)
{
double timefrac = r_viewpoint.TicFrac;
if (paused || bglobal.freeze || (level.flags2 & LEVEL2_FROZEN))
@ -85,7 +85,6 @@ void RenderPolyParticle::Render(PolyRenderThread *thread, const PolyClipPlane &c
args.SetStencilTestValue(stencilValue);
args.SetWriteStencil(false);
args.SetWriteDepth(false);
args.SetClipPlane(0, clipPlane);
args.SetTexture(GetParticleTexture(), ParticleTextureSize, ParticleTextureSize);
args.DrawArray(thread->DrawQueue, vertices, 4, PolyDrawMode::TriangleFan);
}

View File

@ -28,7 +28,7 @@
class RenderPolyParticle
{
public:
void Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane, particle_t *particle, subsector_t *sub, uint32_t stencilValue);
void Render(PolyRenderThread *thread, particle_t *particle, subsector_t *sub, uint32_t stencilValue);
private:
static uint8_t *GetParticleTexture();
@ -45,10 +45,10 @@ class PolyTranslucentParticle : public PolyTranslucentObject
public:
PolyTranslucentParticle(particle_t *particle, subsector_t *sub, uint32_t subsectorDepth, uint32_t stencilValue) : PolyTranslucentObject(subsectorDepth, 0.0), particle(particle), sub(sub), StencilValue(stencilValue) { }
void Render(PolyRenderThread *thread, const PolyClipPlane &portalPlane) override
void Render(PolyRenderThread *thread) override
{
RenderPolyParticle spr;
spr.Render(thread, portalPlane, particle, sub, StencilValue + 1);
spr.Render(thread, particle, sub, StencilValue + 1);
}
particle_t *particle = nullptr;

View File

@ -36,30 +36,30 @@
EXTERN_CVAR(Int, r_3dfloors)
void RenderPolyPlane::RenderPlanes(PolyRenderThread *thread, const PolyClipPlane &clipPlane, const PolyTransferHeights &fakeflat, uint32_t stencilValue, double skyCeilingHeight, double skyFloorHeight, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals, size_t sectorPortalsStart)
void RenderPolyPlane::RenderPlanes(PolyRenderThread *thread, const PolyTransferHeights &fakeflat, uint32_t stencilValue, double skyCeilingHeight, double skyFloorHeight, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals, size_t sectorPortalsStart)
{
if (fakeflat.FrontSector->CenterFloor() == fakeflat.FrontSector->CenterCeiling())
return;
RenderPolyPlane plane;
plane.Render(thread, clipPlane, fakeflat, stencilValue, true, skyCeilingHeight, sectorPortals, sectorPortalsStart);
plane.Render(thread, clipPlane, fakeflat, stencilValue, false, skyFloorHeight, sectorPortals, sectorPortalsStart);
plane.Render(thread, fakeflat, stencilValue, true, skyCeilingHeight, sectorPortals, sectorPortalsStart);
plane.Render(thread, fakeflat, stencilValue, false, skyFloorHeight, sectorPortals, sectorPortalsStart);
}
void RenderPolyPlane::Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane, const PolyTransferHeights &fakeflat, uint32_t stencilValue, bool ceiling, double skyHeight, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals, size_t sectorPortalsStart)
void RenderPolyPlane::Render(PolyRenderThread *thread, const PolyTransferHeights &fakeflat, uint32_t stencilValue, bool ceiling, double skyHeight, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals, size_t sectorPortalsStart)
{
FSectorPortal *portal = fakeflat.FrontSector->ValidatePortal(ceiling ? sector_t::ceiling : sector_t::floor);
if (!portal || (portal->mFlags & PORTSF_INSKYBOX) == PORTSF_INSKYBOX) // Do not recurse into portals we already recursed into
{
RenderNormal(thread, clipPlane, fakeflat, stencilValue, ceiling, skyHeight);
RenderNormal(thread, fakeflat, stencilValue, ceiling, skyHeight);
}
else
{
RenderPortal(thread, clipPlane, fakeflat, stencilValue, ceiling, skyHeight, portal, sectorPortals, sectorPortalsStart);
RenderPortal(thread, fakeflat, stencilValue, ceiling, skyHeight, portal, sectorPortals, sectorPortalsStart);
}
}
void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const PolyClipPlane &clipPlane, const PolyTransferHeights &fakeflat, uint32_t stencilValue, bool ceiling, double skyHeight)
void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const PolyTransferHeights &fakeflat, uint32_t stencilValue, bool ceiling, double skyHeight)
{
const auto &viewpoint = PolyRenderer::Instance()->Viewpoint;
@ -78,7 +78,6 @@ void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const PolyClipPlane
SetDynLights(thread, args, fakeflat.Subsector, ceiling);
args.SetStencilTestValue(stencilValue);
args.SetWriteStencil(true, stencilValue + 1);
args.SetClipPlane(0, clipPlane);
args.SetTexture(tex, DefaultRenderStyle());
args.SetStyle(TriBlendMode::TextureOpaque);
args.DrawArray(thread->DrawQueue, vertices, fakeflat.Subsector->numlines, PolyDrawMode::TriangleFan);
@ -89,7 +88,6 @@ void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const PolyClipPlane
PolyDrawArgs args;
args.SetStencilTestValue(stencilValue);
args.SetClipPlane(0, clipPlane);
args.SetWriteStencil(true, 255);
args.SetWriteColor(false);
args.SetWriteDepth(false);
@ -99,7 +97,7 @@ void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const PolyClipPlane
}
}
void RenderPolyPlane::RenderPortal(PolyRenderThread *thread, const PolyClipPlane &clipPlane, const PolyTransferHeights &fakeflat, uint32_t stencilValue, bool ceiling, double skyHeight, FSectorPortal *portal, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals, size_t sectorPortalsStart)
void RenderPolyPlane::RenderPortal(PolyRenderThread *thread, const PolyTransferHeights &fakeflat, uint32_t stencilValue, bool ceiling, double skyHeight, FSectorPortal *portal, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals, size_t sectorPortalsStart)
{
const auto &viewpoint = PolyRenderer::Instance()->Viewpoint;
@ -156,7 +154,6 @@ void RenderPolyPlane::RenderPortal(PolyRenderThread *thread, const PolyClipPlane
PolyDrawArgs args;
args.SetStencilTestValue(stencilValue);
args.SetClipPlane(0, clipPlane);
args.SetWriteStencil(true, polyportal->StencilValue);
args.SetWriteColor(false);
args.SetWriteDepth(false);
@ -413,7 +410,7 @@ PolyPlaneUVTransform::PolyPlaneUVTransform(const FTransform &transform, FTexture
/////////////////////////////////////////////////////////////////////////////
void Render3DFloorPlane::RenderPlanes(PolyRenderThread *thread, const PolyClipPlane &clipPlane, subsector_t *sub, uint32_t stencilValue, uint32_t subsectorDepth, std::vector<PolyTranslucentObject *> &translucentObjects)
void Render3DFloorPlane::RenderPlanes(PolyRenderThread *thread, subsector_t *sub, uint32_t stencilValue, uint32_t subsectorDepth, std::vector<PolyTranslucentObject *> &translucentObjects)
{
if (!r_3dfloors || sub->sector->CenterFloor() == sub->sector->CenterCeiling())
return;
@ -457,7 +454,7 @@ void Render3DFloorPlane::RenderPlanes(PolyRenderThread *thread, const PolyClipPl
}
if (!plane.Masked)
plane.Render(thread, clipPlane);
plane.Render(thread);
else
translucentObjects.push_back(thread->FrameMemory->NewObject<PolyTranslucent3DFloorPlane>(plane, subsectorDepth));
}
@ -497,14 +494,14 @@ void Render3DFloorPlane::RenderPlanes(PolyRenderThread *thread, const PolyClipPl
}
if (!plane.Masked)
plane.Render(thread, clipPlane);
plane.Render(thread);
else
translucentObjects.push_back(thread->FrameMemory->NewObject<PolyTranslucent3DFloorPlane>(plane, subsectorDepth));
}
}
}
void Render3DFloorPlane::Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane)
void Render3DFloorPlane::Render(PolyRenderThread *thread)
{
FTextureID picnum = ceiling ? *fakeFloor->bottom.texture : *fakeFloor->top.texture;
FTexture *tex = TexMan(picnum);
@ -562,6 +559,5 @@ void Render3DFloorPlane::Render(PolyRenderThread *thread, const PolyClipPlane &c
args.SetStencilTestValue(stencilValue);
args.SetWriteStencil(true, stencilValue + 1);
args.SetTexture(tex, DefaultRenderStyle());
args.SetClipPlane(0, clipPlane);
args.DrawArray(thread->DrawQueue, vertices, sub->numlines, PolyDrawMode::TriangleFan);
}

View File

@ -57,13 +57,13 @@ private:
class RenderPolyPlane
{
public:
static void RenderPlanes(PolyRenderThread *thread, const PolyClipPlane &clipPlane, const PolyTransferHeights &fakeflat, uint32_t stencilValue, double skyCeilingHeight, double skyFloorHeight, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals, size_t sectorPortalsStart);
static void RenderPlanes(PolyRenderThread *thread, const PolyTransferHeights &fakeflat, uint32_t stencilValue, double skyCeilingHeight, double skyFloorHeight, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals, size_t sectorPortalsStart);
private:
void Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane, const PolyTransferHeights &fakeflat, uint32_t stencilValue, bool ceiling, double skyHeight, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals, size_t sectorPortalsStart);
void Render(PolyRenderThread *thread, const PolyTransferHeights &fakeflat, uint32_t stencilValue, bool ceiling, double skyHeight, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals, size_t sectorPortalsStart);
void RenderPortal(PolyRenderThread *thread, const PolyClipPlane &clipPlane, const PolyTransferHeights &fakeflat, uint32_t stencilValue, bool ceiling, double skyHeight, FSectorPortal *portal, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals, size_t sectorPortalsStart);
void RenderNormal(PolyRenderThread *thread, const PolyClipPlane &clipPlane, const PolyTransferHeights &fakeflat, uint32_t stencilValue, bool ceiling, double skyHeight);
void RenderPortal(PolyRenderThread *thread, const PolyTransferHeights &fakeflat, uint32_t stencilValue, bool ceiling, double skyHeight, FSectorPortal *portal, std::vector<std::unique_ptr<PolyDrawSectorPortal>> &sectorPortals, size_t sectorPortalsStart);
void RenderNormal(PolyRenderThread *thread, const PolyTransferHeights &fakeflat, uint32_t stencilValue, bool ceiling, double skyHeight);
void RenderSkyWalls(PolyRenderThread *thread, PolyDrawArgs &args, subsector_t *sub, PolyDrawSectorPortal *polyportal, bool ceiling, double skyHeight);
@ -79,9 +79,9 @@ private:
class Render3DFloorPlane
{
public:
static void RenderPlanes(PolyRenderThread *thread, const PolyClipPlane &clipPlane, subsector_t *sub, uint32_t stencilValue, uint32_t subsectorDepth, std::vector<PolyTranslucentObject *> &translucentObjects);
static void RenderPlanes(PolyRenderThread *thread, subsector_t *sub, uint32_t stencilValue, uint32_t subsectorDepth, std::vector<PolyTranslucentObject *> &translucentObjects);
void Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane);
void Render(PolyRenderThread *thread);
subsector_t *sub = nullptr;
uint32_t stencilValue = 0;
@ -97,9 +97,9 @@ class PolyTranslucent3DFloorPlane : public PolyTranslucentObject
public:
PolyTranslucent3DFloorPlane(Render3DFloorPlane plane, uint32_t subsectorDepth) : PolyTranslucentObject(subsectorDepth, 1e7), plane(plane) { }
void Render(PolyRenderThread *thread, const PolyClipPlane &portalPlane) override
void Render(PolyRenderThread *thread) override
{
plane.Render(thread, portalPlane);
plane.Render(thread);
}
Render3DFloorPlane plane;

View File

@ -255,7 +255,7 @@ void RenderPolyPlayerSprites::RenderSprite(PolyRenderThread *thread, DPSprite *p
if (renderHUDModel)
{
PolyRenderHUDModel(thread, PolyRenderer::Instance()->Scene.CurrentViewpoint->WorldToClip, PolyClipPlane(), 1, pspr, (float)sx, (float)sy);
PolyRenderHUDModel(thread, PolyRenderer::Instance()->Scene.CurrentViewpoint->WorldToClip, 1, pspr, (float)sx, (float)sy);
return;
}

View File

@ -44,11 +44,15 @@ void PolyDrawSectorPortal::Render(int portalDepth)
if (Portal->mType == PORTS_HORIZON || Portal->mType == PORTS_PLANE)
return;
/*angle_t angle1 = PolyCull::PointToPseudoAngle(v1->fX(), v1->fY());
angle_t angle2 = PolyCull::PointToPseudoAngle(v2->fX(), v2->fY());
Segments.clear();
Segments.push_back({ angle1, angle2 });*/
SaveGlobals();
PortalViewpoint = PolyRenderer::Instance()->SetupPerspectiveMatrix();
PortalViewpoint.StencilValue = StencilValue;
PortalViewpoint.PortalPlane = PolyClipPlane(0.0f, 0.0f, 0.0f, 1.0f);
PortalViewpoint.PortalDepth = portalDepth;
PortalViewpoint.PortalEnterSector = Portal->mDestination;
@ -134,28 +138,12 @@ void PolyDrawLinePortal::Render(int portalDepth)
DVector2 pt1 = clipLine->v1->fPos() - PolyRenderer::Instance()->Viewpoint.Pos;
DVector2 pt2 = clipLine->v2->fPos() - PolyRenderer::Instance()->Viewpoint.Pos;
bool backfacing = (pt1.Y * (pt1.X - pt2.X) + pt1.X * (pt2.Y - pt1.Y) >= 0);
vertex_t *v1 = backfacing ? clipLine->v1 : clipLine->v2;
vertex_t *v2 = backfacing ? clipLine->v2 : clipLine->v1;
// Calculate plane clipping
DVector2 planePos = v1->fPos();
DVector2 planeNormal = (v2->fPos() - v1->fPos()).Rotated90CW();
planeNormal.MakeUnit();
double planeD = -(planeNormal | (planePos + planeNormal * 0.001));
PolyClipPlane portalPlane((float)planeNormal.X, (float)planeNormal.Y, (float)0.0f, (float)planeD);
// Cull everything outside the portal line
// To do: this doesn't work for some strange reason..
/*angle_t angle1 = PolyCull::PointToPseudoAngle(v1->fX(), v1->fY());
angle_t angle2 = PolyCull::PointToPseudoAngle(v2->fX(), v2->fY());
Segments.clear();
Segments.push_back({ angle1, angle2 });*/
PortalViewpoint = PolyRenderer::Instance()->SetupPerspectiveMatrix(Mirror);
PortalViewpoint.StencilValue = StencilValue;
PortalViewpoint.PortalPlane = portalPlane;
PortalViewpoint.PortalDepth = portalDepth;
PortalViewpoint.PortalEnterLine = clipLine;
PortalViewpoint.PortalEnterSector = backfacing ? clipLine->frontsector : clipLine->backsector;
PolyRenderer::Instance()->Scene.Render(&PortalViewpoint);

View File

@ -48,7 +48,6 @@ public:
FSectorPortal *Portal = nullptr;
uint32_t StencilValue = 0;
std::vector<PolyPortalVertexRange> Shape;
//std::vector<PolyPortalSegment> Segments;
private:
void SaveGlobals();
@ -73,7 +72,6 @@ public:
line_t *Mirror = nullptr;
uint32_t StencilValue = 0;
std::vector<PolyPortalVertexRange> Shape;
//std::vector<PolyPortalSegment> Segments;
private:
void SaveGlobals();

View File

@ -59,7 +59,7 @@ void RenderPolyScene::Render(PolyPortalViewpoint *viewpoint)
CurrentViewpoint->LinePortalsStart = thread->LinePortals.size();
PolyCullCycles.Clock();
Cull.CullScene(CurrentViewpoint->PortalPlane, CurrentViewpoint->PortalEnterSector);
Cull.CullScene(CurrentViewpoint->PortalEnterSector, CurrentViewpoint->PortalEnterLine);
PolyCullCycles.Unclock();
RenderSectors();
@ -158,15 +158,15 @@ void RenderPolyScene::RenderSubsector(PolyRenderThread *thread, subsector_t *sub
RenderPolyNode(thread, &sub->BSP->Nodes.Last(), subsectorDepth, frontsector);
}
Render3DFloorPlane::RenderPlanes(thread, CurrentViewpoint->PortalPlane, sub, CurrentViewpoint->StencilValue, subsectorDepth, thread->TranslucentObjects);
RenderPolyPlane::RenderPlanes(thread, CurrentViewpoint->PortalPlane, sub, CurrentViewpoint->StencilValue, Cull.MaxCeilingHeight, Cull.MinFloorHeight, thread->SectorPortals, CurrentViewpoint->SectorPortalsStart);
Render3DFloorPlane::RenderPlanes(thread, sub, CurrentViewpoint->StencilValue, subsectorDepth, thread->TranslucentObjects);
RenderPolyPlane::RenderPlanes(thread, sub, CurrentViewpoint->StencilValue, Cull.MaxCeilingHeight, Cull.MinFloorHeight, thread->SectorPortals, CurrentViewpoint->SectorPortalsStart);
}
else
{
PolyTransferHeights fakeflat(sub);
Render3DFloorPlane::RenderPlanes(thread, CurrentViewpoint->PortalPlane, sub, CurrentViewpoint->StencilValue, subsectorDepth, thread->TranslucentObjects);
RenderPolyPlane::RenderPlanes(thread, CurrentViewpoint->PortalPlane, fakeflat, CurrentViewpoint->StencilValue, Cull.MaxCeilingHeight, Cull.MinFloorHeight, thread->SectorPortals, CurrentViewpoint->SectorPortalsStart);
Render3DFloorPlane::RenderPlanes(thread, sub, CurrentViewpoint->StencilValue, subsectorDepth, thread->TranslucentObjects);
RenderPolyPlane::RenderPlanes(thread, fakeflat, CurrentViewpoint->StencilValue, Cull.MaxCeilingHeight, Cull.MinFloorHeight, thread->SectorPortals, CurrentViewpoint->SectorPortalsStart);
for (uint32_t i = 0; i < sub->numlines; i++)
{
@ -237,7 +237,7 @@ void RenderPolyScene::RenderPolySubsector(PolyRenderThread *thread, subsector_t
sub->flags |= SSECF_DRAWN;
}
RenderPolyWall::RenderLine(thread, CurrentViewpoint->PortalPlane, line, frontsector, subsectorDepth, CurrentViewpoint->StencilValue, thread->TranslucentObjects, thread->LinePortals, CurrentViewpoint->LinePortalsStart, CurrentViewpoint->PortalEnterLine);
RenderPolyWall::RenderLine(thread, line, frontsector, subsectorDepth, CurrentViewpoint->StencilValue, thread->TranslucentObjects, thread->LinePortals, CurrentViewpoint->LinePortalsStart, CurrentViewpoint->PortalEnterLine);
}
}
}
@ -311,12 +311,12 @@ void RenderPolyScene::RenderLine(PolyRenderThread *thread, subsector_t *sub, seg
for (unsigned int i = 0; i < line->backsector->e->XFloor.ffloors.Size(); i++)
{
F3DFloor *fakeFloor = line->backsector->e->XFloor.ffloors[i];
RenderPolyWall::Render3DFloorLine(thread, CurrentViewpoint->PortalPlane, line, frontsector, subsectorDepth, CurrentViewpoint->StencilValue, fakeFloor, thread->TranslucentObjects);
RenderPolyWall::Render3DFloorLine(thread, line, frontsector, subsectorDepth, CurrentViewpoint->StencilValue, fakeFloor, thread->TranslucentObjects);
}
}
// Render wall, and update culling info if its an occlusion blocker
RenderPolyWall::RenderLine(thread, CurrentViewpoint->PortalPlane, line, frontsector, subsectorDepth, CurrentViewpoint->StencilValue, thread->TranslucentObjects, thread->LinePortals, CurrentViewpoint->LinePortalsStart, CurrentViewpoint->PortalEnterLine);
RenderPolyWall::RenderLine(thread, line, frontsector, subsectorDepth, CurrentViewpoint->StencilValue, thread->TranslucentObjects, thread->LinePortals, CurrentViewpoint->LinePortalsStart, CurrentViewpoint->PortalEnterLine);
}
void RenderPolyScene::RenderPortals()
@ -339,7 +339,6 @@ void RenderPolyScene::RenderPortals()
PolyTriangleDrawer::SetTransform(thread->DrawQueue, transform);
PolyDrawArgs args;
args.SetClipPlane(0, CurrentViewpoint->PortalPlane);
args.SetWriteColor(!enterPortals);
args.SetDepthTest(false);
@ -394,7 +393,7 @@ void RenderPolyScene::RenderTranslucent()
for (size_t i = CurrentViewpoint->ObjectsEnd; i > CurrentViewpoint->ObjectsStart; i--)
{
PolyTranslucentObject *obj = objects[i - 1];
obj->Render(thread, CurrentViewpoint->PortalPlane);
obj->Render(thread);
obj->~PolyTranslucentObject();
}

View File

@ -40,7 +40,7 @@ public:
PolyTranslucentObject(uint32_t subsectorDepth = 0, double distanceSquared = 0.0) : subsectorDepth(subsectorDepth), DistanceSquared(distanceSquared) { }
virtual ~PolyTranslucentObject() { }
virtual void Render(PolyRenderThread *thread, const PolyClipPlane &portalPlane) = 0;
virtual void Render(PolyRenderThread *thread) = 0;
bool operator<(const PolyTranslucentObject &other) const
{
@ -60,7 +60,6 @@ class PolyPortalViewpoint
public:
Mat4f WorldToView;
Mat4f WorldToClip;
PolyClipPlane PortalPlane;
uint32_t StencilValue = 0;
int PortalDepth = 0;
bool Mirror = false;

View File

@ -72,7 +72,7 @@ bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right)
return true;
}
void RenderPolySprite::Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane, AActor *thing, subsector_t *sub, uint32_t stencilValue, float t1, float t2)
void RenderPolySprite::Render(PolyRenderThread *thread, AActor *thing, subsector_t *sub, uint32_t stencilValue, float t1, float t2)
{
if (r_models)
{
@ -83,7 +83,7 @@ void RenderPolySprite::Render(PolyRenderThread *thread, const PolyClipPlane &cli
{
const auto &viewpoint = PolyRenderer::Instance()->Viewpoint;
DVector3 pos = thing->InterpolatedPosition(viewpoint.TicFrac);
PolyRenderModel(thread, PolyRenderer::Instance()->Scene.CurrentViewpoint->WorldToClip, clipPlane, stencilValue, (float)pos.X, (float)pos.Y, (float)pos.Z, modelframe, thing);
PolyRenderModel(thread, PolyRenderer::Instance()->Scene.CurrentViewpoint->WorldToClip, stencilValue, (float)pos.X, (float)pos.Y, (float)pos.Z, modelframe, thing);
return;
}
}
@ -161,7 +161,6 @@ void RenderPolySprite::Render(PolyRenderThread *thread, const PolyClipPlane &cli
SetDynlight(thing, args);
args.SetLight(GetColorTable(sub->sector->Colormap, sub->sector->SpecialColors[sector_t::sprites], true), lightlevel, PolyRenderer::Instance()->Light.SpriteGlobVis(foggy), fullbrightSprite);
args.SetStencilTestValue(stencilValue);
args.SetClipPlane(0, clipPlane);
if ((thing->renderflags & RF_ZDOOMTRANS) && r_UseVanillaTransparency)
args.SetStyle(LegacyRenderStyles[STYLE_Normal], 1.0f, thing->fillcolor, thing->Translation, tex, fullbrightSprite);
else

View File

@ -27,7 +27,7 @@
class RenderPolySprite
{
public:
void Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane, AActor *thing, subsector_t *sub, uint32_t stencilValue, float t1, float t2);
void Render(PolyRenderThread *thread, AActor *thing, subsector_t *sub, uint32_t stencilValue, float t1, float t2);
static bool GetLine(AActor *thing, DVector2 &left, DVector2 &right);
static bool IsThingCulled(AActor *thing);
@ -45,17 +45,17 @@ class PolyTranslucentThing : public PolyTranslucentObject
public:
PolyTranslucentThing(AActor *thing, subsector_t *sub, uint32_t subsectorDepth, double dist, float t1, float t2, uint32_t stencilValue) : PolyTranslucentObject(subsectorDepth, dist), thing(thing), sub(sub), SpriteLeft(t1), SpriteRight(t2), StencilValue(stencilValue) { }
void Render(PolyRenderThread *thread, const PolyClipPlane &portalPlane) override
void Render(PolyRenderThread *thread) override
{
if ((thing->renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
{
RenderPolyWallSprite wallspr;
wallspr.Render(thread, portalPlane, thing, sub, StencilValue + 1);
wallspr.Render(thread, thing, sub, StencilValue + 1);
}
else
{
RenderPolySprite spr;
spr.Render(thread, portalPlane, thing, sub, StencilValue + 1, SpriteLeft, SpriteRight);
spr.Render(thread, thing, sub, StencilValue + 1, SpriteLeft, SpriteRight);
}
}

View File

@ -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, size_t linePortalsStart, line_t *portalEnterLine)
bool RenderPolyWall::RenderLine(PolyRenderThread *thread, 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,9 +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 (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))
if (portalEnterLine == line->linedef)
{
return false;
}
@ -64,9 +62,7 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const PolyClipPlane &c
}
else if (line->linedef && line->linedef->isVisualPortal())
{
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))
if (portalEnterLine == line->linedef)
{
return false;
}
@ -108,7 +104,7 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const PolyClipPlane &c
wall.Wallpart = side_t::mid;
wall.Texture = GetTexture(wall.Line, wall.Side, side_t::mid);
wall.Polyportal = polyportal;
wall.Render(thread, clipPlane);
wall.Render(thread);
return true;
}
}
@ -145,7 +141,7 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const PolyClipPlane &c
wall.BottomTexZ = MIN(MIN(backceilz1, frontceilz1), MIN(backceilz2, frontceilz2));
wall.Wallpart = side_t::top;
wall.Texture = GetTexture(wall.Line, wall.Side, side_t::top);
wall.Render(thread, clipPlane);
wall.Render(thread);
}
if ((bottomfloorz1 < bottomceilz1 || bottomfloorz2 < bottomceilz2) && line->sidedef && !bothSkyFloor)
@ -157,7 +153,7 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const PolyClipPlane &c
wall.UnpeggedCeil2 = topceilz2;
wall.Wallpart = side_t::bottom;
wall.Texture = GetTexture(wall.Line, wall.Side, side_t::bottom);
wall.Render(thread, clipPlane);
wall.Render(thread);
}
if (line->sidedef)
@ -179,7 +175,7 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const PolyClipPlane &c
if (polyportal)
{
wall.Polyportal = polyportal;
wall.Render(thread, clipPlane);
wall.Render(thread);
}
}
}
@ -193,7 +189,7 @@ bool RenderPolyWall::IsFogBoundary(sector_t *front, sector_t *back)
(front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum);
}
void RenderPolyWall::Render3DFloorLine(PolyRenderThread *thread, const PolyClipPlane &clipPlane, seg_t *line, sector_t *frontsector, uint32_t subsectorDepth, uint32_t stencilValue, F3DFloor *fakeFloor, std::vector<PolyTranslucentObject*> &translucentWallsOutput)
void RenderPolyWall::Render3DFloorLine(PolyRenderThread *thread, seg_t *line, sector_t *frontsector, uint32_t subsectorDepth, uint32_t stencilValue, F3DFloor *fakeFloor, std::vector<PolyTranslucentObject*> &translucentWallsOutput)
{
if (!(fakeFloor->flags & FF_EXISTS)) return;
if (!(fakeFloor->flags & FF_RENDERPLANES)) return;
@ -243,7 +239,7 @@ void RenderPolyWall::Render3DFloorLine(PolyRenderThread *thread, const PolyClipP
wall.Texture = GetTexture(wall.Line, wall.Side, side_t::mid);
if (!wall.Masked)
wall.Render(thread, clipPlane);
wall.Render(thread);
else
translucentWallsOutput.push_back(thread->FrameMemory->NewObject<PolyTranslucentWall>(wall));
}
@ -258,7 +254,7 @@ void RenderPolyWall::SetCoords(const DVector2 &v1, const DVector2 &v2, double ce
this->floor2 = floor2;
}
void RenderPolyWall::Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane)
void RenderPolyWall::Render(PolyRenderThread *thread)
{
bool foggy = false;
if (!Texture && !Polyportal && !FogBoundary)
@ -324,7 +320,6 @@ void RenderPolyWall::Render(PolyRenderThread *thread, const PolyClipPlane &clipP
args.SetLight(Colormap, GetLightLevel(), PolyRenderer::Instance()->Light.WallGlobVis(foggy), false);
if (Texture && !Polyportal)
args.SetTexture(Texture, DefaultRenderStyle());
args.SetClipPlane(0, clipPlane);
SetDynLights(thread, args);
@ -369,7 +364,7 @@ void RenderPolyWall::Render(PolyRenderThread *thread, const PolyClipPlane &clipP
DrawStripes(thread, args, vertices);
}
RenderPolyDecal::RenderWallDecals(thread, clipPlane, LineSeg, StencilValue + 1);
RenderPolyDecal::RenderWallDecals(thread, LineSeg, StencilValue + 1);
}
void RenderPolyWall::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args)

View File

@ -31,11 +31,11 @@ class PolyCull;
class RenderPolyWall
{
public:
static bool 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);
static void Render3DFloorLine(PolyRenderThread *thread, const PolyClipPlane &clipPlane, seg_t *line, sector_t *frontsector, uint32_t subsectorDepth, uint32_t stencilValue, F3DFloor *fakeFloor, std::vector<PolyTranslucentObject*> &translucentWallsOutput);
static bool RenderLine(PolyRenderThread *thread, 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);
static void Render3DFloorLine(PolyRenderThread *thread, seg_t *line, sector_t *frontsector, uint32_t subsectorDepth, uint32_t stencilValue, F3DFloor *fakeFloor, std::vector<PolyTranslucentObject*> &translucentWallsOutput);
void SetCoords(const DVector2 &v1, const DVector2 &v2, double ceil1, double floor1, double ceil2, double floor2);
void Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane);
void Render(PolyRenderThread *thread);
DVector2 v1;
DVector2 v2;
@ -101,9 +101,9 @@ class PolyTranslucentWall : public PolyTranslucentObject
public:
PolyTranslucentWall(RenderPolyWall wall) : PolyTranslucentObject(wall.SubsectorDepth, 1e6), wall(wall) { }
void Render(PolyRenderThread *thread, const PolyClipPlane &portalPlane) override
void Render(PolyRenderThread *thread) override
{
wall.Render(thread, portalPlane);
wall.Render(thread);
}
RenderPolyWall wall;

View File

@ -30,7 +30,7 @@
#include "polyrenderer/scene/poly_light.h"
#include "polyrenderer/poly_renderthread.h"
void RenderPolyWallSprite::Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane, AActor *thing, subsector_t *sub, uint32_t stencilValue)
void RenderPolyWallSprite::Render(PolyRenderThread *thread, AActor *thing, subsector_t *sub, uint32_t stencilValue)
{
if (RenderPolySprite::IsThingCulled(thing))
return;
@ -104,7 +104,6 @@ void RenderPolyWallSprite::Render(PolyRenderThread *thread, const PolyClipPlane
args.SetLight(GetColorTable(sub->sector->Colormap, sub->sector->SpecialColors[sector_t::sprites], true), lightlevel, PolyRenderer::Instance()->Light.WallGlobVis(foggy), fullbrightSprite);
args.SetStencilTestValue(stencilValue);
args.SetTexture(tex, thing->RenderStyle);
args.SetClipPlane(0, clipPlane);
args.SetDepthTest(true);
args.SetWriteDepth(false);
args.SetWriteStencil(false);

View File

@ -27,5 +27,5 @@
class RenderPolyWallSprite
{
public:
void Render(PolyRenderThread *thread, const PolyClipPlane &clipPlane, AActor *thing, subsector_t *sub, uint32_t stencilValue);
void Render(PolyRenderThread *thread, AActor *thing, subsector_t *sub, uint32_t stencilValue);
};