- Don't add 3D floor dummy draw segments to the list

This commit is contained in:
Magnus Norddahl 2017-07-02 14:46:19 +02:00
parent e19c8eba62
commit efb1a8d113
6 changed files with 28 additions and 32 deletions

View file

@ -319,9 +319,15 @@ namespace swrenderer
side_t *sidedef = mLineSegment->sidedef; side_t *sidedef = mLineSegment->sidedef;
RenderPortal *renderportal = Thread->Portal.get(); RenderPortal *renderportal = Thread->Portal.get();
Clip3DFloors *clip3d = Thread->Clip3D.get();
DrawSegment *draw_segment = Thread->FrameMemory->NewObject<DrawSegment>(); DrawSegment *draw_segment = Thread->FrameMemory->NewObject<DrawSegment>();
Thread->DrawSegments->Push(draw_segment);
// 3D floors code abuses the line render code to update plane clipping
// lists but doesn't actually draw anything.
bool onlyUpdatePlaneClip = (clip3d->fake3D & FAKE3D_FAKEMASK) ? true : false;
if (!onlyUpdatePlaneClip)
Thread->DrawSegments->Push(draw_segment);
draw_segment->CurrentPortalUniq = renderportal->CurrentPortalUniq; draw_segment->CurrentPortalUniq = renderportal->CurrentPortalUniq;
draw_segment->sx1 = WallC.sx1; draw_segment->sx1 = WallC.sx1;
@ -342,10 +348,6 @@ namespace swrenderer
draw_segment->bFakeBoundary = false; draw_segment->bFakeBoundary = false;
draw_segment->foggy = foggy; draw_segment->foggy = foggy;
Clip3DFloors *clip3d = Thread->Clip3D.get();
if (clip3d->fake3D & FAKE3D_FAKEMASK) draw_segment->fake = 1;
else draw_segment->fake = 0;
draw_segment->sprtopclip = nullptr; draw_segment->sprtopclip = nullptr;
draw_segment->sprbottomclip = nullptr; draw_segment->sprbottomclip = nullptr;
draw_segment->maskedtexturecol = nullptr; draw_segment->maskedtexturecol = nullptr;
@ -406,26 +408,29 @@ namespace swrenderer
} }
} }
if (!draw_segment->fake && r_3dfloors && mBackSector->e && mBackSector->e->XFloor.ffloors.Size()) { if (!onlyUpdatePlaneClip && r_3dfloors)
for (i = 0; i < (int)mBackSector->e->XFloor.ffloors.Size(); i++) { {
F3DFloor *rover = mBackSector->e->XFloor.ffloors[i]; if (mBackSector->e && mBackSector->e->XFloor.ffloors.Size()) {
if (rover->flags & FF_RENDERSIDES && (!(rover->flags & FF_INVERTSIDES) || rover->flags & FF_ALLSIDES)) { for (i = 0; i < (int)mBackSector->e->XFloor.ffloors.Size(); i++) {
draw_segment->bFakeBoundary |= 1; F3DFloor *rover = mBackSector->e->XFloor.ffloors[i];
break; if (rover->flags & FF_RENDERSIDES && (!(rover->flags & FF_INVERTSIDES) || rover->flags & FF_ALLSIDES)) {
draw_segment->bFakeBoundary |= 1;
break;
}
}
}
if (mFrontSector->e && mFrontSector->e->XFloor.ffloors.Size()) {
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;
break;
}
} }
} }
} }
if (!draw_segment->fake && r_3dfloors && mFrontSector->e && mFrontSector->e->XFloor.ffloors.Size()) {
for (i = 0; i < (int)mFrontSector->e->XFloor.ffloors.Size(); i++) { if (!onlyUpdatePlaneClip)
F3DFloor *rover = mFrontSector->e->XFloor.ffloors[i];
if (rover->flags & FF_RENDERSIDES && (rover->flags & FF_ALLSIDES || rover->flags & FF_INVERTSIDES)) {
draw_segment->bFakeBoundary |= 2;
break;
}
}
}
// kg3D - no for fakes
if (!draw_segment->fake)
// allocate space for masked texture tables, if needed // allocate space for masked texture tables, if needed
// [RH] Don't just allocate the space; fill it in too. // [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->bFakeBoundary || IsFogBoundary(mFrontSector, mBackSector)) &&
@ -508,7 +513,7 @@ namespace swrenderer
draw_segment->shade = LightVisibility::LightLevelToShade(mLineSegment->sidedef->GetLightLevel(foggy, mLineSegment->frontsector->lightlevel) + LightVisibility::ActualExtraLight(foggy, Thread->Viewport.get()), foggy); draw_segment->shade = LightVisibility::LightLevelToShade(mLineSegment->sidedef->GetLightLevel(foggy, mLineSegment->frontsector->lightlevel) + LightVisibility::ActualExtraLight(foggy, Thread->Viewport.get()), foggy);
} }
if ((draw_segment->bFogBoundary || draw_segment->maskedtexturecol != nullptr) && !draw_segment->fake) if (draw_segment->bFogBoundary || draw_segment->maskedtexturecol != nullptr)
{ {
Thread->DrawSegments->PushTranslucent(draw_segment); Thread->DrawSegments->PushTranslucent(draw_segment);
} }

View file

@ -217,7 +217,6 @@ namespace swrenderer
draw_segment->swall = nullptr; draw_segment->swall = nullptr;
draw_segment->bFogBoundary = false; draw_segment->bFogBoundary = false;
draw_segment->curline = nullptr; draw_segment->curline = nullptr;
draw_segment->fake = 0;
draw_segment->foggy = false; draw_segment->foggy = false;
memcpy(draw_segment->sprbottomclip, floorclip + pl->left, (pl->right - pl->left) * sizeof(short)); memcpy(draw_segment->sprbottomclip, floorclip + pl->left, (pl->right - pl->left) * sizeof(short));
memcpy(draw_segment->sprtopclip, ceilingclip + pl->left, (pl->right - pl->left) * sizeof(short)); memcpy(draw_segment->sprtopclip, ceilingclip + pl->left, (pl->right - pl->left) * sizeof(short));

View file

@ -161,8 +161,6 @@ namespace swrenderer
// [ZZ] the same as above // [ZZ] the same as above
if (ds->CurrentPortalUniq != renderportal->CurrentPortalUniq) if (ds->CurrentPortalUniq != renderportal->CurrentPortalUniq)
continue; continue;
// kg3D - no fake segs
if (ds->fake) continue;
if (ds->maskedtexturecol != nullptr || ds->bFogBoundary) if (ds->maskedtexturecol != nullptr || ds->bFogBoundary)
{ {
RenderDrawSegment renderer(Thread); RenderDrawSegment renderer(Thread);

View file

@ -131,9 +131,6 @@ namespace swrenderer
{ {
ds = Segment(groupIndex); ds = Segment(groupIndex);
// kg3D - no clipping on fake segs
if (ds->fake) continue;
if (ds->silhouette & SIL_BOTTOM) if (ds->silhouette & SIL_BOTTOM)
{ {
short *clip1 = clipbottom + ds->x1; short *clip1 = clipbottom + ds->x1;

View file

@ -51,7 +51,6 @@ namespace swrenderer
FWallTmapVals tmapvals; FWallTmapVals tmapvals;
int fake; // ident fake drawseg, don't draw and clip sprites backups
int CurrentPortalUniq; // [ZZ] to identify the portal that this drawseg is in. used for sprite clipping. int CurrentPortalUniq; // [ZZ] to identify the portal that this drawseg is in. used for sprite clipping.
}; };

View file

@ -365,8 +365,6 @@ namespace swrenderer
{ {
DrawSegment *ds = segmentlist->Segment(index); DrawSegment *ds = segmentlist->Segment(index);
// kg3D - no clipping on fake segs
if (ds->fake) continue;
// determine if the drawseg obscures the sprite // determine if the drawseg obscures the sprite
if (ds->x1 >= x2 || ds->x2 <= x1 || if (ds->x1 >= x2 || ds->x2 <= x1 ||
(!(ds->silhouette & SIL_BOTH) && ds->maskedtexturecol == nullptr && (!(ds->silhouette & SIL_BOTH) && ds->maskedtexturecol == nullptr &&