diff --git a/src/rendering/swrenderer/line/r_line.cpp b/src/rendering/swrenderer/line/r_line.cpp index a60491915..6780bb10c 100644 --- a/src/rendering/swrenderer/line/r_line.cpp +++ b/src/rendering/swrenderer/line/r_line.cpp @@ -881,7 +881,7 @@ namespace swrenderer texcoords.ProjectTop(Thread->Viewport.get(), mFrontSector, mBackSector, mLineSegment, WallC.sx1, WallC.sx2, WallT, mTopTexture); RenderWallPart renderWallpart(Thread); - renderWallpart.Render(mFrontSector, mLineSegment, WallC, mTopTexture, x1, x2, walltop.ScreenY, wallupper.ScreenY, texcoords, MAX(mFrontCeilingZ1, mFrontCeilingZ2), MIN(mBackCeilingZ1, mBackCeilingZ2), false, false, OPAQUE); + renderWallpart.Render(mFrontSector, mLineSegment, WallC, mTopTexture, x1, x2, walltop.ScreenY, wallupper.ScreenY, texcoords, false, false, OPAQUE); } void SWRenderLine::RenderMiddleTexture(int x1, int x2) @@ -893,7 +893,7 @@ namespace swrenderer texcoords.ProjectMid(Thread->Viewport.get(), mFrontSector, mLineSegment, WallC.sx1, WallC.sx2, WallT, mMiddleTexture); RenderWallPart renderWallpart(Thread); - renderWallpart.Render(mFrontSector, mLineSegment, WallC, mMiddleTexture, x1, x2, walltop.ScreenY, wallbottom.ScreenY, texcoords, MAX(mFrontCeilingZ1, mFrontCeilingZ2), MIN(mFrontFloorZ1, mFrontFloorZ2), false, false, OPAQUE); + renderWallpart.Render(mFrontSector, mLineSegment, WallC, mMiddleTexture, x1, x2, walltop.ScreenY, wallbottom.ScreenY, texcoords, false, false, OPAQUE); } void SWRenderLine::RenderBottomTexture(int x1, int x2) @@ -906,7 +906,7 @@ namespace swrenderer texcoords.ProjectBottom(Thread->Viewport.get(), mFrontSector, mBackSector, mLineSegment, WallC.sx1, WallC.sx2, WallT, mBottomTexture); RenderWallPart renderWallpart(Thread); - renderWallpart.Render(mFrontSector, mLineSegment, WallC, mBottomTexture, x1, x2, walllower.ScreenY, wallbottom.ScreenY, texcoords, MAX(mBackFloorZ1, mBackFloorZ2), MIN(mFrontFloorZ1, mFrontFloorZ2), false, false, OPAQUE); + renderWallpart.Render(mFrontSector, mLineSegment, WallC, mBottomTexture, x1, x2, walllower.ScreenY, wallbottom.ScreenY, texcoords, false, false, OPAQUE); } //////////////////////////////////////////////////////////////////////////// diff --git a/src/rendering/swrenderer/line/r_renderdrawsegment.cpp b/src/rendering/swrenderer/line/r_renderdrawsegment.cpp index d7f7fd0d2..b6d990133 100644 --- a/src/rendering/swrenderer/line/r_renderdrawsegment.cpp +++ b/src/rendering/swrenderer/line/r_renderdrawsegment.cpp @@ -196,14 +196,11 @@ namespace swrenderer sector_t tempsec; const sector_t* lightsector = Thread->OpaquePass->FakeFlat(frontsector, &tempsec, nullptr, nullptr, nullptr, 0, 0, 0, 0); - double top, bot; - GetMaskedWallTopBottom(ds, top, bot); - fixed_t alpha = FLOAT2FIXED((float)MIN(curline->linedef->alpha, 1.)); bool additive = (curline->linedef->flags & ML_ADDTRANS) != 0; RenderWallPart renderWallpart(Thread); - renderWallpart.Render(lightsector, curline, ds->WallC, tex, x1, x2, mceilingclip, mfloorclip, ds->texcoords, top, bot, true, additive, alpha); + renderWallpart.Render(lightsector, curline, ds->WallC, tex, x1, x2, mceilingclip, mfloorclip, ds->texcoords, true, additive, alpha); } void RenderDrawSegment::Render3DFloorWall(DrawSegment *ds, int x1, int x2, F3DFloor *rover, double clipTop, double clipBottom, FSoftwareTexture *rw_pic) @@ -223,11 +220,8 @@ namespace swrenderer ProjectedWallTexcoords walltexcoords; walltexcoords.Project3DFloor(Thread->Viewport.get(), rover, curline, ds->WallC.sx1, ds->WallC.sx2, ds->tmapvals, rw_pic); - double top, bot; - GetMaskedWallTopBottom(ds, top, bot); - RenderWallPart renderWallpart(Thread); - renderWallpart.Render(lightsector, curline, ds->WallC, rw_pic, x1, x2, wallupper.ScreenY, walllower.ScreenY, walltexcoords, top, bot, true, (rover->flags & FF_ADDITIVETRANS) != 0, Alpha); + renderWallpart.Render(lightsector, curline, ds->WallC, rw_pic, x1, x2, wallupper.ScreenY, walllower.ScreenY, walltexcoords, true, (rover->flags & FF_ADDITIVETRANS) != 0, Alpha); RenderDecal::RenderDecals(Thread, ds, curline, lightsector, wallupper.ScreenY, walllower.ScreenY, true); } diff --git a/src/rendering/swrenderer/line/r_walldraw.cpp b/src/rendering/swrenderer/line/r_walldraw.cpp index 33b319743..3e7818348 100644 --- a/src/rendering/swrenderer/line/r_walldraw.cpp +++ b/src/rendering/swrenderer/line/r_walldraw.cpp @@ -446,7 +446,7 @@ namespace swrenderer void RenderWallPart::ProcessWall(const short *uwal, const short *dwal, const ProjectedWallTexcoords& texcoords) { CameraLight *cameraLight = CameraLight::Instance(); - if (cameraLight->FixedColormap() != NULL || cameraLight->FixedLightLevel() >= 0 || !(lightsector->e && lightsector->e->XFloor.lightlist.Size())) + if (cameraLight->FixedColormap() || cameraLight->FixedLightLevel() >= 0 || !(lightsector->e && lightsector->e->XFloor.lightlist.Size())) { ProcessNormalWall(uwal, dwal, texcoords); } @@ -456,78 +456,6 @@ namespace swrenderer } } - //============================================================================= - // - // ProcessWallNP2 - // - // This is a wrapper around ProcessWall that helps it tile textures whose heights - // are not powers of 2. It divides the wall into texture-sized strips and calls - // ProcessNormalWall for each of those. Since only one repetition of the texture fits - // in each strip, ProcessWall will not tile. - // - //============================================================================= - - void RenderWallPart::ProcessWallNP2(const short *uwal, const short *dwal, ProjectedWallTexcoords texcoords, double top, double bot) - { - ProjectedWallLine most1, most2, most3; - double texheight = rw_pic->GetHeight(); - double partition; - double scaledtexheight = texheight / texcoords.yscale; - - if (texcoords.yscale >= 0) - { // normal orientation: draw strips from top to bottom - partition = top - fmod(top - texcoords.texturemid / texcoords.yscale - Thread->Viewport->viewpoint.Pos.Z, scaledtexheight); - if (partition == top) - { - partition -= scaledtexheight; - } - const short *up = uwal; - short *down = most1.ScreenY; - texcoords.texturemid = (partition - Thread->Viewport->viewpoint.Pos.Z) * texcoords.yscale + texheight; - while (partition > bot) - { - ProjectedWallCull j = most3.Project(Thread->Viewport.get(), partition - Thread->Viewport->viewpoint.Pos.Z, &WallC); - if (j != ProjectedWallCull::OutsideAbove) - { - for (int j = x1; j < x2; ++j) - { - down[j] = clamp(most3.ScreenY[j], up[j], dwal[j]); - } - ProcessWall(up, down, texcoords); - up = down; - down = (down == most1.ScreenY) ? most2.ScreenY : most1.ScreenY; - } - partition -= scaledtexheight; - texcoords.texturemid -= texheight; - } - ProcessWall(up, dwal, texcoords); - } - else - { // upside down: draw strips from bottom to top - partition = bot - fmod(bot - texcoords.texturemid / texcoords.yscale - Thread->Viewport->viewpoint.Pos.Z, scaledtexheight); - short *up = most1.ScreenY; - const short *down = dwal; - texcoords.texturemid = (partition - Thread->Viewport->viewpoint.Pos.Z) * texcoords.yscale + texheight; - while (partition < top) - { - ProjectedWallCull j = most3.Project(Thread->Viewport.get(), partition - Thread->Viewport->viewpoint.Pos.Z, &WallC); - if (j != ProjectedWallCull::OutsideBelow) - { - for (int j = x1; j < x2; ++j) - { - up[j] = clamp(most3.ScreenY[j], uwal[j], down[j]); - } - ProcessWall(up, down, texcoords); - down = up; - up = (up == most1.ScreenY) ? most2.ScreenY : most1.ScreenY; - } - partition -= scaledtexheight; - texcoords.texturemid -= texheight; - } - ProcessWall(uwal, down, texcoords); - } - } - FLightNode* RenderWallPart::GetLightList() { CameraLight* cameraLight = CameraLight::Instance(); @@ -539,7 +467,7 @@ namespace swrenderer return nullptr; } - void RenderWallPart::Render(const sector_t *lightsector, seg_t *curline, const FWallCoords &WallC, FSoftwareTexture *pic, int x1, int x2, const short *walltop, const short *wallbottom, const ProjectedWallTexcoords& texcoords, double top, double bottom, bool mask, bool additive, fixed_t alpha) + void RenderWallPart::Render(const sector_t *lightsector, seg_t *curline, const FWallCoords &WallC, FSoftwareTexture *pic, int x1, int x2, const short *walltop, const short *wallbottom, const ProjectedWallTexcoords& texcoords, bool mask, bool additive, fixed_t alpha) { this->x1 = x1; this->x2 = x2; @@ -558,14 +486,7 @@ namespace swrenderer Thread->PrepareTexture(pic, DefaultRenderStyle()); // Get correct render style? Shaded won't get here. - if (rw_pic->GetHeight() != (1 << rw_pic->GetHeightBits())) - { - ProcessWallNP2(walltop, wallbottom, texcoords, top, bottom); - } - else - { - ProcessWall(walltop, wallbottom, texcoords); - } + ProcessWall(walltop, wallbottom, texcoords); } RenderWallPart::RenderWallPart(RenderThread *thread) diff --git a/src/rendering/swrenderer/line/r_walldraw.h b/src/rendering/swrenderer/line/r_walldraw.h index 909886411..ebf71834c 100644 --- a/src/rendering/swrenderer/line/r_walldraw.h +++ b/src/rendering/swrenderer/line/r_walldraw.h @@ -55,8 +55,6 @@ namespace swrenderer const short *walltop, const short *wallbottom, const ProjectedWallTexcoords &texcoords, - double top, - double bottom, bool mask, bool additive, fixed_t alpha); @@ -64,7 +62,6 @@ namespace swrenderer RenderThread *Thread = nullptr; private: - void ProcessWallNP2(const short *uwal, const short *dwal, ProjectedWallTexcoords texcoords, double top, double bot); void ProcessWall(const short *uwal, const short *dwal, const ProjectedWallTexcoords& texcoords); void ProcessStripedWall(const short *uwal, const short *dwal, const ProjectedWallTexcoords& texcoords); void ProcessNormalWall(const short *uwal, const short *dwal, const ProjectedWallTexcoords& texcoords);