diff --git a/src/hwrenderer/scene/hw_decal.cpp b/src/hwrenderer/scene/hw_decal.cpp index 5a3e509bfd..815032314f 100644 --- a/src/hwrenderer/scene/hw_decal.cpp +++ b/src/hwrenderer/scene/hw_decal.cpp @@ -95,7 +95,7 @@ void GLDecal::DrawDecal(HWDrawInfo *di, FRenderState &state) for (unsigned k = 0; k < lightlist.Size(); k++) { - secplane_t &lowplane = k == lightlist.Size() - 1 ? bottomplane : lightlist[k + 1].plane; + secplane_t &lowplane = k == lightlist.Size() - 1 ? frontsector->floorplane : lightlist[k + 1].plane; float low1 = lowplane.ZatPoint(dv[1].x, dv[1].y); float low2 = lowplane.ZatPoint(dv[2].x, dv[2].y); @@ -404,7 +404,7 @@ void GLWall::ProcessDecal(HWDrawInfo *di, DBaseDecal *decal, const FVector3 &nor gldecal->alpha = decal->Alpha; gldecal->zcenter = zpos - decalheight * 0.5f; - gldecal->bottomplane = bottomplane; + gldecal->frontsector = frontsector; gldecal->Normal = normal; gldecal->lightlist = lightlist; memcpy(gldecal->dv, dv, sizeof(dv)); diff --git a/src/hwrenderer/scene/hw_drawstructs.h b/src/hwrenderer/scene/hw_drawstructs.h index 35a6d340e3..d500e67957 100644 --- a/src/hwrenderer/scene/hw_drawstructs.h +++ b/src/hwrenderer/scene/hw_drawstructs.h @@ -186,7 +186,6 @@ public: }; - secplane_t topplane, bottomplane; // we need to save these to pass them to the shader for calculating glows. // these are not the same as ytop and ybottom!!! float zceil[2]; @@ -198,6 +197,7 @@ public: public: seg_t * seg; // this gives the easiest access to all other structs involved subsector_t * sub; // For polyobjects + sector_t *frontsector, *backsector; //private: void PutWall(HWDrawInfo *di, bool translucent); @@ -411,7 +411,7 @@ struct GLDecal int rellight; float alpha; FColormap Colormap; - secplane_t bottomplane; + sector_t *frontsector; FVector3 Normal; void DrawDecal(HWDrawInfo *di, FRenderState &state); diff --git a/src/hwrenderer/scene/hw_walls.cpp b/src/hwrenderer/scene/hw_walls.cpp index b91c38ae1a..f8455c2459 100644 --- a/src/hwrenderer/scene/hw_walls.cpp +++ b/src/hwrenderer/scene/hw_walls.cpp @@ -140,7 +140,7 @@ void GLWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags) state.EnableGlow(true); state.SetGlowParams(topglowcolor, bottomglowcolor); } - state.SetGlowPlanes(topplane, bottomplane); + state.SetGlowPlanes(frontsector->ceilingplane, frontsector->floorplane); state.SetMaterial(gltexture, flags & 3, 0, -1); if (type == RENDERWALL_M2SNF) @@ -167,7 +167,7 @@ void GLWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags) for (unsigned i = 0; i < lightlist->Size(); i++) { - secplane_t &lowplane = i == (*lightlist).Size() - 1 ? bottomplane : (*lightlist)[i + 1].plane; + secplane_t &lowplane = i == (*lightlist).Size() - 1 ? frontsector->floorplane : (*lightlist)[i + 1].plane; // this must use the exact same calculation method as GLWall::Process etc. float low1 = lowplane.ZatPoint(vertexes[0]); float low2 = lowplane.ZatPoint(vertexes[1]); @@ -1799,6 +1799,8 @@ void GLWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_ // note: we always have a valid sidedef and linedef reference when getting here. this->seg = seg; + this->frontsector = frontsector; + this->backsector = backsector; vertindex = 0; vertcount = 0; @@ -1893,8 +1895,6 @@ void GLWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_ if (frontsector->GetWallGlow(topglowcolor, bottomglowcolor)) flags |= GLWF_GLOW; - topplane = frontsector->ceilingplane; - bottomplane = frontsector->floorplane; zfloor[0] = ffh1 = segfront->floorplane.ZatPoint(v1); zfloor[1] = ffh2 = segfront->floorplane.ZatPoint(v2); @@ -2104,6 +2104,8 @@ void GLWall::ProcessLowerMiniseg(HWDrawInfo *di, seg_t *seg, sector_t * frontsec if (bfh > ffh) { this->seg = seg; + this->frontsector = frontsector; + this->backsector = backsector; this->sub = NULL; vertex_t * v1 = seg->v1; @@ -2129,8 +2131,6 @@ void GLWall::ProcessLowerMiniseg(HWDrawInfo *di, seg_t *seg, sector_t * frontsec Colormap = frontsector->Colormap; if (frontsector->GetWallGlow(topglowcolor, bottomglowcolor)) flags |= GLWF_GLOW; - topplane = frontsector->ceilingplane; - bottomplane = frontsector->floorplane; dynlightindex = -1; zfloor[0] = zfloor[1] = ffh;