- Fix voxel clipping for r_scene_multithreaded

This commit is contained in:
Magnus Norddahl 2017-07-02 18:22:28 +02:00
parent 4545539045
commit 6d8281c812
3 changed files with 6 additions and 9 deletions

View file

@ -527,8 +527,8 @@ namespace swrenderer
void RenderPortal::SetMainPortal() void RenderPortal::SetMainPortal()
{ {
WindowLeft = 0; WindowLeft = Thread->X1;
WindowRight = viewwidth; WindowRight = Thread->X2;
MirrorFlags = 0; MirrorFlags = 0;
CurrentPortal = nullptr; CurrentPortal = nullptr;
CurrentPortalUniq = 0; CurrentPortalUniq = 0;

View file

@ -84,10 +84,6 @@ namespace swrenderer
if (x1 >= x2) if (x1 >= x2)
return; return;
// Reject sprites outside the slice rendered by the thread
if (x2 < thread->X1 || x1 > thread->X2)
return;
// [RH] Sprites split behind a one-sided line can also be discarded. // [RH] Sprites split behind a one-sided line can also be discarded.
if (spr->sector == nullptr) if (spr->sector == nullptr)
return; return;

View file

@ -457,10 +457,7 @@ namespace swrenderer
if (voxptr >= voxend) continue; if (voxptr >= voxend) continue;
lx = xs_RoundToInt(nx * centerxwide_f / (ny + y1)) + viewport->viewwindow.centerx; lx = xs_RoundToInt(nx * centerxwide_f / (ny + y1)) + viewport->viewwindow.centerx;
if (lx < 0) lx = 0;
rx = xs_RoundToInt((nx + nxoff) * centerxwide_f / (ny + y2)) + viewport->viewwindow.centerx; rx = xs_RoundToInt((nx + nxoff) * centerxwide_f / (ny + y2)) + viewport->viewwindow.centerx;
if (rx > viewwidth) rx = viewwidth;
if (rx <= lx) continue;
if (flags & DVF_MIRRORED) if (flags & DVF_MIRRORED)
{ {
@ -469,6 +466,10 @@ namespace swrenderer
rx = t; rx = t;
} }
if (lx < this->x1) lx = this->x1;
if (rx > this->x2) rx = this->x2;
if (rx <= lx) continue;
fixed_t l1 = xs_RoundToInt(centerxwidebig_f / (ny - yoff)); fixed_t l1 = xs_RoundToInt(centerxwidebig_f / (ny - yoff));
fixed_t l2 = xs_RoundToInt(centerxwidebig_f / (ny + yoff)); fixed_t l2 = xs_RoundToInt(centerxwidebig_f / (ny + yoff));
for (; voxptr < voxend; voxptr = (kvxslab_t *)((uint8_t *)voxptr + voxptr->zleng + 3)) for (; voxptr < voxend; voxptr = (kvxslab_t *)((uint8_t *)voxptr + voxptr->zleng + 3))