- get rid of FAKE3D_REFRESHCLIP and fix holes in 3d floors with wrapped midtextures

This commit is contained in:
Magnus Norddahl 2018-03-08 01:28:23 +01:00
parent a55be25a9d
commit 7cb4deabdd
6 changed files with 15 additions and 25 deletions

View file

@ -1055,7 +1055,7 @@ namespace swrenderer
Clip3DFloors *clip3d = Thread->Clip3D.get();
// kg3D - fake planes clipping
if (clip3d->fake3D & FAKE3D_REFRESHCLIP)
if (clip3d->fake3D & FAKE3D_FAKEBACK)
{
auto ceilingclip = Thread->OpaquePass->ceilingclip;
auto floorclip = Thread->OpaquePass->floorclip;

View file

@ -123,8 +123,6 @@ namespace swrenderer
}
}
bool wrap = (curline->linedef->flags & ML_WRAP_MIDTEX) || (curline->sidedef->Flags & WALLF_WRAP_MIDTEX);
// [RH] Draw fog partition
bool renderwall = true;
bool notrelevant = false;
@ -145,7 +143,7 @@ namespace swrenderer
}
if (renderwall)
notrelevant = RenderWall(ds, x1, x2, walldrawerargs, columndrawerargs, visible, basecolormap, wallshade, wrap);
notrelevant = RenderWall(ds, x1, x2, walldrawerargs, columndrawerargs, visible, basecolormap, wallshade);
if (ds->Has3DFloorFrontSectorWalls() || ds->Has3DFloorBackSectorWalls())
{
@ -153,22 +151,12 @@ namespace swrenderer
}
if (!notrelevant)
{
if (clip3d->fake3D & FAKE3D_REFRESHCLIP)
{
if (!wrap)
{
assert(ds->bkup != nullptr);
memcpy(ds->sprtopclip, ds->bkup, (ds->x2 - ds->x1) * 2);
}
}
else
{
ds->sprclipped = true;
fillshort(ds->sprtopclip - ds->x1 + x1, x2 - x1, viewheight);
}
}
}
bool RenderDrawSegment::RenderWall(DrawSegment *ds, int x1, int x2, WallDrawerArgs &walldrawerargs, SpriteDrawerArgs &columndrawerargs, bool visible, FDynamicColormap *basecolormap, int wallshade, bool wrap)
bool RenderDrawSegment::RenderWall(DrawSegment *ds, int x1, int x2, WallDrawerArgs &walldrawerargs, SpriteDrawerArgs &columndrawerargs, bool visible, FDynamicColormap *basecolormap, int wallshade)
{
auto viewport = Thread->Viewport.get();
Clip3DFloors *clip3d = Thread->Clip3D.get();
@ -220,6 +208,7 @@ namespace swrenderer
double rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid);
bool wrap = (curline->linedef->flags & ML_WRAP_MIDTEX) || (curline->sidedef->Flags & WALLF_WRAP_MIDTEX);
if (!wrap)
{ // Texture does not wrap vertically.
double textop;

View file

@ -37,7 +37,7 @@ namespace swrenderer
RenderThread *Thread = nullptr;
private:
bool RenderWall(DrawSegment *ds, int x1, int x2, WallDrawerArgs &walldrawerargs, SpriteDrawerArgs &columndrawerargs, bool visible, FDynamicColormap *basecolormap, int wallshade, bool wrap);
bool RenderWall(DrawSegment *ds, int x1, int x2, WallDrawerArgs &walldrawerargs, SpriteDrawerArgs &columndrawerargs, bool visible, FDynamicColormap *basecolormap, int wallshade);
void ClipMidtex(int x1, int x2);
void RenderFakeWall(DrawSegment *ds, int x1, int x2, F3DFloor *rover, int wallshade, FDynamicColormap *basecolormap);
void RenderFakeWallRange(DrawSegment *ds, int x1, int x2, int wallshade);

View file

@ -49,7 +49,6 @@ namespace swrenderer
// sorting stage:
FAKE3D_CLIPBOTTOM = 1, // clip bottom
FAKE3D_CLIPTOP = 2, // clip top
FAKE3D_REFRESHCLIP = 4, // refresh clip info
FAKE3D_DOWN2UP = 8, // rendering from down to up (floors)
};

View file

@ -149,11 +149,6 @@ namespace swrenderer
// render any remaining masked mid textures
if (renew)
{
Thread->Clip3D->fake3D |= FAKE3D_REFRESHCLIP;
}
for (unsigned int index = 0; index != drawseglist->SegmentsCount(); index++)
{
DrawSegment *ds = drawseglist->Segment(index);
@ -161,12 +156,18 @@ namespace swrenderer
// [ZZ] the same as above
if (ds->CurrentPortalUniq != renderportal->CurrentPortalUniq)
continue;
if (ds->maskedtexturecol != nullptr || ds->bFogBoundary)
if (ds->maskedtexturecol || ds->bFogBoundary)
{
RenderDrawSegment renderer(Thread);
renderer.Render(ds, ds->x1, ds->x2);
if (renew && ds->bFogBoundary) // don't draw fogboundary again
ds->bFogBoundary = false;
if (renew && ds->sprclipped)
{
memcpy(ds->sprtopclip, ds->bkup, (ds->x2 - ds->x1) * sizeof(short));
ds->sprclipped = false;
}
}
}
}

View file

@ -47,6 +47,7 @@ namespace swrenderer
fixed_t *maskedtexturecol = nullptr;
float *swall = nullptr;
short *bkup = nullptr; // sprtopclip backup, for mid and fake textures
bool sprclipped = false; // True if draw segment was used for clipping sprites
FWallTmapVals tmapvals;