- Make it more clear what bFakeBoundary did

This commit is contained in:
Magnus Norddahl 2017-07-02 15:35:29 +02:00
parent efb1a8d113
commit adcc7588ec
3 changed files with 34 additions and 33 deletions

View file

@ -334,7 +334,7 @@ namespace swrenderer
draw_segment->sx2 = WallC.sx2;
draw_segment->sz1 = WallC.sz1;
draw_segment->sz2 = WallC.sz2;
draw_segment->cx = WallC.tleft.X;;
draw_segment->cx = WallC.tleft.X;
draw_segment->cy = WallC.tleft.Y;
draw_segment->cdx = WallC.tright.X - WallC.tleft.X;
draw_segment->cdy = WallC.tright.Y - WallC.tleft.Y;
@ -344,16 +344,8 @@ namespace swrenderer
draw_segment->x1 = start;
draw_segment->x2 = stop;
draw_segment->curline = mLineSegment;
draw_segment->bFogBoundary = false;
draw_segment->bFakeBoundary = false;
draw_segment->foggy = foggy;
draw_segment->sprtopclip = nullptr;
draw_segment->sprbottomclip = nullptr;
draw_segment->maskedtexturecol = nullptr;
draw_segment->bkup = nullptr;
draw_segment->swall = nullptr;
bool markportal = ShouldMarkPortal();
if (markportal)
@ -371,8 +363,6 @@ namespace swrenderer
else
{
// two sided line
draw_segment->silhouette = 0;
if (mFrontFloorZ1 > mBackFloorZ1 || mFrontFloorZ2 > mBackFloorZ2 ||
mBackSector->floorplane.PointOnSide(Thread->Viewport->viewpoint.Pos) < 0)
{
@ -414,7 +404,7 @@ namespace swrenderer
for (i = 0; i < (int)mBackSector->e->XFloor.ffloors.Size(); i++) {
F3DFloor *rover = mBackSector->e->XFloor.ffloors[i];
if (rover->flags & FF_RENDERSIDES && (!(rover->flags & FF_INVERTSIDES) || rover->flags & FF_ALLSIDES)) {
draw_segment->bFakeBoundary |= 1;
draw_segment->SetHas3DFloorBackSectorWalls();
break;
}
}
@ -423,7 +413,7 @@ namespace swrenderer
for (i = 0; i < (int)mFrontSector->e->XFloor.ffloors.Size(); i++) {
F3DFloor *rover = mFrontSector->e->XFloor.ffloors[i];
if (rover->flags & FF_RENDERSIDES && (rover->flags & FF_ALLSIDES || rover->flags & FF_INVERTSIDES)) {
draw_segment->bFakeBoundary |= 2;
draw_segment->SetHas3DFloorFrontSectorWalls();
break;
}
}
@ -433,7 +423,7 @@ namespace swrenderer
if (!onlyUpdatePlaneClip)
// allocate space for masked texture tables, if needed
// [RH] Don't just allocate the space; fill it in too.
if ((TexMan(sidedef->GetTexture(side_t::mid), true)->UseType != FTexture::TEX_Null || draw_segment->bFakeBoundary || IsFogBoundary(mFrontSector, mBackSector)) &&
if ((TexMan(sidedef->GetTexture(side_t::mid), true)->UseType != FTexture::TEX_Null || draw_segment->Has3DFloorWalls() || IsFogBoundary(mFrontSector, mBackSector)) &&
(mCeilingClipped != ProjectedWallCull::OutsideBelow || !sidedef->GetTexture(side_t::top).isValid()) &&
(mFloorClipped != ProjectedWallCull::OutsideAbove || !sidedef->GetTexture(side_t::bottom).isValid()) &&
(WallC.sz1 >= TOO_CLOSE_Z && WallC.sz2 >= TOO_CLOSE_Z))
@ -449,10 +439,10 @@ namespace swrenderer
memcpy(draw_segment->bkup, &Thread->OpaquePass->ceilingclip[start], sizeof(short)*(stop - start));
draw_segment->bFogBoundary = IsFogBoundary(mFrontSector, mBackSector);
if (sidedef->GetTexture(side_t::mid).isValid() || draw_segment->bFakeBoundary)
if (sidedef->GetTexture(side_t::mid).isValid() || draw_segment->Has3DFloorWalls())
{
if (sidedef->GetTexture(side_t::mid).isValid())
draw_segment->bFakeBoundary |= 4; // it is also mid texture
draw_segment->SetHas3DFloorMidTexture();
draw_segment->maskedtexturecol = Thread->FrameMemory->AllocMemory<fixed_t>(stop - start);
draw_segment->swall = Thread->FrameMemory->AllocMemory<float>(stop - start);

View file

@ -79,7 +79,7 @@ namespace swrenderer
FDynamicColormap *patchstylecolormap = nullptr;
bool visible = columndrawerargs.SetStyle(viewport, LegacyRenderStyles[additive ? STYLE_Add : STYLE_Translucent], alpha, 0, 0, patchstylecolormap);
if (!visible && !ds->bFogBoundary && !ds->bFakeBoundary)
if (!visible && !ds->bFogBoundary && !ds->Has3DFloorWalls())
{
return;
}
@ -139,7 +139,7 @@ namespace swrenderer
if (ds->maskedtexturecol == nullptr)
renderwall = false;
}
else if ((ds->bFakeBoundary && !(ds->bFakeBoundary & 4)) || !visible)
else if ((ds->Has3DFloorWalls() && !ds->Has3DFloorMidTexture()) || !visible)
{
renderwall = false;
}
@ -147,7 +147,7 @@ namespace swrenderer
if (renderwall)
notrelevant = RenderWall(ds, x1, x2, walldrawerargs, columndrawerargs, visible, basecolormap, wallshade, wrap);
if (ds->bFakeBoundary & 3)
if (ds->Has3DFloorFrontSectorWalls() || ds->Has3DFloorBackSectorWalls())
{
RenderFakeWallRange(ds, x1, x2, wallshade);
}
@ -540,7 +540,7 @@ namespace swrenderer
{
return;
}
if ((ds->bFakeBoundary & 3) == 2)
if (ds->Has3DFloorFrontSectorWalls() && !ds->Has3DFloorBackSectorWalls())
{
sector_t *sec = backsector;
backsector = frontsector;
@ -709,7 +709,7 @@ namespace swrenderer
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->FixedLightLevel() < 0)
{
if ((ds->bFakeBoundary & 3) == 2)
if (ds->Has3DFloorFrontSectorWalls() && !ds->Has3DFloorBackSectorWalls())
{
for (j = backsector->e->XFloor.lightlist.Size() - 1; j >= 0; j--)
{
@ -888,7 +888,7 @@ namespace swrenderer
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->FixedLightLevel() < 0)
{
if ((ds->bFakeBoundary & 3) == 2)
if (ds->Has3DFloorFrontSectorWalls() && !ds->Has3DFloorBackSectorWalls())
{
for (j = backsector->e->XFloor.lightlist.Size() - 1; j >= 0; j--)
{

View file

@ -36,22 +36,33 @@ namespace swrenderer
float siz1, siz2; // 1/z for left, right of parent seg on screen
float cx, cy, cdx, cdy;
float yscale;
uint8_t silhouette; // 0=none, 1=bottom, 2=top, 3=both
uint8_t bFogBoundary;
uint8_t bFakeBoundary; // for fake walls
int shade;
bool foggy;
uint8_t silhouette = 0; // 0=none, 1=bottom, 2=top, 3=both
bool bFogBoundary = false;
int shade = 0;
bool foggy = false;
// Pointers to lists for sprite clipping, all three adjusted so [x1] is first value.
short *sprtopclip;
short *sprbottomclip;
fixed_t *maskedtexturecol;
float *swall;
short *bkup; // sprtopclip backup, for mid and fake textures
short *sprtopclip = nullptr;
short *sprbottomclip = nullptr;
fixed_t *maskedtexturecol = nullptr;
float *swall = nullptr;
short *bkup = nullptr; // sprtopclip backup, for mid and fake textures
FWallTmapVals tmapvals;
int CurrentPortalUniq; // [ZZ] to identify the portal that this drawseg is in. used for sprite clipping.
int CurrentPortalUniq = 0; // [ZZ] to identify the portal that this drawseg is in. used for sprite clipping.
bool Has3DFloorWalls() const { return b3DFloorBoundary != 0; }
bool Has3DFloorFrontSectorWalls() const { return (b3DFloorBoundary & 2) == 2; }
bool Has3DFloorBackSectorWalls() const { return (b3DFloorBoundary & 1) == 1; }
bool Has3DFloorMidTexture() const { return (b3DFloorBoundary & 4) == 4; }
void SetHas3DFloorFrontSectorWalls() { b3DFloorBoundary |= 2; }
void SetHas3DFloorBackSectorWalls() { b3DFloorBoundary |= 1; }
void SetHas3DFloorMidTexture() { b3DFloorBoundary |= 4; }
private:
uint8_t b3DFloorBoundary = 0; // 1=backsector, 2=frontsector, 4=midtexture
};
struct DrawSegmentGroup