diff --git a/src/rendering/hwrenderer/scene/hw_drawstructs.h b/src/rendering/hwrenderer/scene/hw_drawstructs.h index 5dbe20404..374477c8c 100644 --- a/src/rendering/hwrenderer/scene/hw_drawstructs.h +++ b/src/rendering/hwrenderer/scene/hw_drawstructs.h @@ -222,7 +222,6 @@ public: void CheckTexturePosition(FTexCoordInfo* tci); void Put3DWall(HWWallDispatcher* di, FRenderState& state, lightlist_t* lightlist, bool translucent); - bool SplitWallComplex(HWWallDispatcher* di, FRenderState& state, sector_t* frontsector, bool translucent, float& maplightbottomleft, float& maplightbottomright); void SplitWall(HWWallDispatcher* di, FRenderState& state, sector_t* frontsector, bool translucent); void SetupLights(HWDrawInfo* di, FRenderState& state, FDynLightData& lightdata); diff --git a/src/rendering/hwrenderer/scene/hw_walls.cpp b/src/rendering/hwrenderer/scene/hw_walls.cpp index 4f2347d1c..0b9fe91c9 100644 --- a/src/rendering/hwrenderer/scene/hw_walls.cpp +++ b/src/rendering/hwrenderer/scene/hw_walls.cpp @@ -699,107 +699,6 @@ void HWWall::Put3DWall(HWWallDispatcher *di, FRenderState& state, lightlist_t * PutWall(di, state, translucent); } -//========================================================================== -// -// Splits a wall vertically if a 3D-floor -// creates different lighting across the wall -// -//========================================================================== - -bool HWWall::SplitWallComplex(HWWallDispatcher *di, FRenderState& state, sector_t * frontsector, bool translucent, float& maplightbottomleft, float& maplightbottomright) -{ - // check for an intersection with the upper plane - if ((maplightbottomleftztop[1]) || - (maplightbottomleft>ztop[0] && maplightbottomright(fabsf(glseg.x2 - glseg.x1), fabsf(glseg.y2 - glseg.y1)); - - float dch = ztop[1] - ztop[0]; - float dfh = maplightbottomright - maplightbottomleft; - float coeff = (ztop[0] - maplightbottomleft) / (dfh - dch); - - // check for inaccuracies - let's be a little generous here! - if (coeff*clen<.1f) - { - maplightbottomleft = ztop[0]; - } - else if (coeff*clen>clen - .1f) - { - maplightbottomright = ztop[1]; - } - else - { - // split the wall in two at the intersection and recursively split both halves - HWWall copyWall1 = *this, copyWall2 = *this; - - copyWall1.glseg.x2 = copyWall2.glseg.x1 = glseg.x1 + coeff * (glseg.x2 - glseg.x1); - copyWall1.glseg.y2 = copyWall2.glseg.y1 = glseg.y1 + coeff * (glseg.y2 - glseg.y1); - copyWall1.ztop[1] = copyWall2.ztop[0] = ztop[0] + coeff * (ztop[1] - ztop[0]); - copyWall1.zbottom[1] = copyWall2.zbottom[0] = zbottom[0] + coeff * (zbottom[1] - zbottom[0]); - copyWall1.glseg.fracright = copyWall2.glseg.fracleft = glseg.fracleft + coeff * (glseg.fracright - glseg.fracleft); - copyWall1.tcs[UPRGT].u = copyWall2.tcs[UPLFT].u = tcs[UPLFT].u + coeff * (tcs[UPRGT].u - tcs[UPLFT].u); - copyWall1.tcs[UPRGT].v = copyWall2.tcs[UPLFT].v = tcs[UPLFT].v + coeff * (tcs[UPRGT].v - tcs[UPLFT].v); - copyWall1.tcs[LORGT].u = copyWall2.tcs[LOLFT].u = tcs[LOLFT].u + coeff * (tcs[LORGT].u - tcs[LOLFT].u); - copyWall1.tcs[LORGT].v = copyWall2.tcs[LOLFT].v = tcs[LOLFT].v + coeff * (tcs[LORGT].v - tcs[LOLFT].v); - copyWall1.lightuv[UPRGT].u = copyWall2.lightuv[UPLFT].u = lightuv[UPLFT].u + coeff * (lightuv[UPRGT].u - lightuv[UPLFT].u); - copyWall1.lightuv[UPRGT].v = copyWall2.lightuv[UPLFT].v = lightuv[UPLFT].v + coeff * (lightuv[UPRGT].v - lightuv[UPLFT].v); - copyWall1.lightuv[LORGT].u = copyWall2.lightuv[LOLFT].u = lightuv[LOLFT].u + coeff * (lightuv[LORGT].u - lightuv[LOLFT].u); - copyWall1.lightuv[LORGT].v = copyWall2.lightuv[LOLFT].v = lightuv[LOLFT].v + coeff * (lightuv[LORGT].v - lightuv[LOLFT].v); - - copyWall1.SplitWall(di, state, frontsector, translucent); - copyWall2.SplitWall(di, state, frontsector, translucent); - return true; - } - } - - // check for an intersection with the lower plane - if ((maplightbottomleftzbottom[1]) || - (maplightbottomleft>zbottom[0] && maplightbottomright(fabsf(glseg.x2 - glseg.x1), fabsf(glseg.y2 - glseg.y1)); - - float dch = zbottom[1] - zbottom[0]; - float dfh = maplightbottomright - maplightbottomleft; - float coeff = (zbottom[0] - maplightbottomleft) / (dfh - dch); - - // check for inaccuracies - let's be a little generous here because there's - // some conversions between floats and fixed_t's involved - if (coeff*clen<.1f) - { - maplightbottomleft = zbottom[0]; - } - else if (coeff*clen>clen - .1f) - { - maplightbottomright = zbottom[1]; - } - else - { - // split the wall in two at the intersection and recursively split both halves - HWWall copyWall1 = *this, copyWall2 = *this; - - copyWall1.glseg.x2 = copyWall2.glseg.x1 = glseg.x1 + coeff * (glseg.x2 - glseg.x1); - copyWall1.glseg.y2 = copyWall2.glseg.y1 = glseg.y1 + coeff * (glseg.y2 - glseg.y1); - copyWall1.ztop[1] = copyWall2.ztop[0] = ztop[0] + coeff * (ztop[1] - ztop[0]); - copyWall1.zbottom[1] = copyWall2.zbottom[0] = zbottom[0] + coeff * (zbottom[1] - zbottom[0]); - copyWall1.glseg.fracright = copyWall2.glseg.fracleft = glseg.fracleft + coeff * (glseg.fracright - glseg.fracleft); - copyWall1.tcs[UPRGT].u = copyWall2.tcs[UPLFT].u = tcs[UPLFT].u + coeff * (tcs[UPRGT].u - tcs[UPLFT].u); - copyWall1.tcs[UPRGT].v = copyWall2.tcs[UPLFT].v = tcs[UPLFT].v + coeff * (tcs[UPRGT].v - tcs[UPLFT].v); - copyWall1.tcs[LORGT].u = copyWall2.tcs[LOLFT].u = tcs[LOLFT].u + coeff * (tcs[LORGT].u - tcs[LOLFT].u); - copyWall1.tcs[LORGT].v = copyWall2.tcs[LOLFT].v = tcs[LOLFT].v + coeff * (tcs[LORGT].v - tcs[LOLFT].v); - copyWall1.lightuv[UPRGT].u = copyWall2.lightuv[UPLFT].u = lightuv[UPLFT].u + coeff * (lightuv[UPRGT].u - lightuv[UPLFT].u); - copyWall1.lightuv[UPRGT].v = copyWall2.lightuv[UPLFT].v = lightuv[UPLFT].v + coeff * (lightuv[UPRGT].v - lightuv[UPLFT].v); - copyWall1.lightuv[LORGT].u = copyWall2.lightuv[LOLFT].u = lightuv[LOLFT].u + coeff * (lightuv[LORGT].u - lightuv[LOLFT].u); - copyWall1.lightuv[LORGT].v = copyWall2.lightuv[LOLFT].v = lightuv[LOLFT].v + coeff * (lightuv[LORGT].v - lightuv[LOLFT].v); - - copyWall1.SplitWall(di, state, frontsector, translucent); - copyWall2.SplitWall(di, state, frontsector, translucent); - return true; - } - } - - return false; -} - void HWWall::SplitWall(HWWallDispatcher *di, FRenderState& state, sector_t * frontsector, bool translucent) { float maplightbottomleft;