diff --git a/src/rendering/swrenderer/line/r_line.cpp b/src/rendering/swrenderer/line/r_line.cpp index 24623bcfe..035c6f74c 100644 --- a/src/rendering/swrenderer/line/r_line.cpp +++ b/src/rendering/swrenderer/line/r_line.cpp @@ -884,7 +884,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, GetLightList()); + renderWallpart.Render(mFrontSector, mLineSegment, WallC, mTopTexture, x1, x2, walltop.ScreenY, wallupper.ScreenY, texcoords, MAX(mFrontCeilingZ1, mFrontCeilingZ2), MIN(mBackCeilingZ1, mBackCeilingZ2), false, false, OPAQUE); } void SWRenderLine::RenderMiddleTexture(int x1, int x2) @@ -896,7 +896,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, GetLightList()); + renderWallpart.Render(mFrontSector, mLineSegment, WallC, mMiddleTexture, x1, x2, walltop.ScreenY, wallbottom.ScreenY, texcoords, MAX(mFrontCeilingZ1, mFrontCeilingZ2), MIN(mFrontFloorZ1, mFrontFloorZ2), false, false, OPAQUE); } void SWRenderLine::RenderBottomTexture(int x1, int x2) @@ -909,18 +909,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, GetLightList()); - } - - FLightNode *SWRenderLine::GetLightList() - { - CameraLight *cameraLight = CameraLight::Instance(); - if ((cameraLight->FixedLightLevel() >= 0) || cameraLight->FixedColormap()) - return nullptr; // [SP] Don't draw dynlights if invul/lightamp active - else if (mLineSegment && mLineSegment->sidedef) - return mLineSegment->sidedef->lighthead; - else - return nullptr; + renderWallpart.Render(mFrontSector, mLineSegment, WallC, mBottomTexture, x1, x2, walllower.ScreenY, wallbottom.ScreenY, texcoords, MAX(mBackFloorZ1, mBackFloorZ2), MIN(mFrontFloorZ1, mFrontFloorZ2), false, false, OPAQUE); } //////////////////////////////////////////////////////////////////////////// diff --git a/src/rendering/swrenderer/line/r_line.h b/src/rendering/swrenderer/line/r_line.h index cc226d768..a4edca524 100644 --- a/src/rendering/swrenderer/line/r_line.h +++ b/src/rendering/swrenderer/line/r_line.h @@ -74,8 +74,6 @@ namespace swrenderer void RenderMiddleTexture(int x1, int x2); void RenderBottomTexture(int x1, int x2); - FLightNode *GetLightList(); - bool IsFogBoundary(sector_t *front, sector_t *back) const; bool SkyboxCompare(sector_t *frontsector, sector_t *backsector) const; diff --git a/src/rendering/swrenderer/line/r_renderdrawsegment.cpp b/src/rendering/swrenderer/line/r_renderdrawsegment.cpp index 8a3619892..829ae98e6 100644 --- a/src/rendering/swrenderer/line/r_renderdrawsegment.cpp +++ b/src/rendering/swrenderer/line/r_renderdrawsegment.cpp @@ -203,7 +203,7 @@ namespace swrenderer 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, nullptr); + renderWallpart.Render(lightsector, curline, ds->WallC, tex, x1, x2, mceilingclip, mfloorclip, ds->texcoords, top, bot, true, additive, alpha); } void RenderDrawSegment::Render3DFloorWall(DrawSegment *ds, int x1, int x2, F3DFloor *rover, double clipTop, double clipBottom, FSoftwareTexture *rw_pic) @@ -227,7 +227,7 @@ namespace swrenderer 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, nullptr); + renderWallpart.Render(lightsector, curline, ds->WallC, rw_pic, x1, x2, wallupper.ScreenY, walllower.ScreenY, walltexcoords, top, bot, true, (rover->flags & FF_ADDITIVETRANS) != 0, Alpha); ProjectedWallLight walllight; walllight.SetColormap(lightsector, curline); diff --git a/src/rendering/swrenderer/line/r_walldraw.cpp b/src/rendering/swrenderer/line/r_walldraw.cpp index 074ecd665..33b319743 100644 --- a/src/rendering/swrenderer/line/r_walldraw.cpp +++ b/src/rendering/swrenderer/line/r_walldraw.cpp @@ -528,19 +528,31 @@ namespace swrenderer } } - 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, FLightNode *light_list) + FLightNode* RenderWallPart::GetLightList() + { + CameraLight* cameraLight = CameraLight::Instance(); + if ((cameraLight->FixedLightLevel() >= 0) || cameraLight->FixedColormap()) + return nullptr; // [SP] Don't draw dynlights if invul/lightamp active + else if (curline && curline->sidedef) + return curline->sidedef->lighthead; + else + 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) { this->x1 = x1; this->x2 = x2; this->lightsector = lightsector; this->curline = curline; this->WallC = WallC; - this->light_list = light_list; this->rw_pic = pic; this->mask = mask; this->additive = additive; this->alpha = alpha; + light_list = GetLightList(); + mLight.SetColormap(lightsector, curline); mLight.SetLightLeft(Thread, WallC); diff --git a/src/rendering/swrenderer/line/r_walldraw.h b/src/rendering/swrenderer/line/r_walldraw.h index cebe5bf65..909886411 100644 --- a/src/rendering/swrenderer/line/r_walldraw.h +++ b/src/rendering/swrenderer/line/r_walldraw.h @@ -59,8 +59,7 @@ namespace swrenderer double bottom, bool mask, bool additive, - fixed_t alpha, - FLightNode *light_list); + fixed_t alpha); RenderThread *Thread = nullptr; @@ -70,6 +69,7 @@ namespace swrenderer void ProcessStripedWall(const short *uwal, const short *dwal, const ProjectedWallTexcoords& texcoords); void ProcessNormalWall(const short *uwal, const short *dwal, const ProjectedWallTexcoords& texcoords); void SetLights(WallDrawerArgs &drawerargs, int x, int y1); + FLightNode* GetLightList(); int x1 = 0; int x2 = 0;