mirror of https://github.com/ZDoom/gzdoom.git
- fixed dynamic lights in legacy mode.
Since they mess around with the texture coordinates, these need to be backed up and restored afterward. There was also an issue with the ValidNormal check that was suffering from imprecisions that cause walls to be skipped, so the check was removed because it was mostly pointless.
This commit is contained in:
parent
6cd8b1b3eb
commit
852c42bbd4
|
@ -755,11 +755,6 @@ static bool PrepareLight(GLWall *wall, ADynamicLight * light, int pass)
|
||||||
auto normal = glseg.Normal();
|
auto normal = glseg.Normal();
|
||||||
p.Set(normal, -normal.X * glseg.x1 - normal.Z * glseg.y1);
|
p.Set(normal, -normal.X * glseg.x1 - normal.Z * glseg.y1);
|
||||||
|
|
||||||
if (!p.ValidNormal())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gl_SetupLight(wall->seg->frontsector->PortalGroup, p, light, nearPt, up, right, scale, true, pass != GLPASS_LIGHTTEX))
|
if (!gl_SetupLight(wall->seg->frontsector->PortalGroup, p, light, nearPt, up, right, scale, true, pass != GLPASS_LIGHTTEX))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -817,6 +812,9 @@ void FDrawInfo::RenderLightsCompat(GLWall *wall, int pass)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto vertcountsave = wall->vertcount;
|
||||||
|
auto vertindexsave = wall->vertindex;
|
||||||
|
|
||||||
texcoord save[4];
|
texcoord save[4];
|
||||||
memcpy(save, wall->tcs, sizeof(wall->tcs));
|
memcpy(save, wall->tcs, sizeof(wall->tcs));
|
||||||
while (node)
|
while (node)
|
||||||
|
@ -833,12 +831,14 @@ void FDrawInfo::RenderLightsCompat(GLWall *wall, int pass)
|
||||||
if (PrepareLight(wall, light, pass))
|
if (PrepareLight(wall, light, pass))
|
||||||
{
|
{
|
||||||
wall->vertcount = 0;
|
wall->vertcount = 0;
|
||||||
|
wall->MakeVertices(this, false);
|
||||||
RenderWall(wall, GLWall::RWF_TEXTURED);
|
RenderWall(wall, GLWall::RWF_TEXTURED);
|
||||||
}
|
}
|
||||||
node = node->nextLight;
|
node = node->nextLight;
|
||||||
}
|
}
|
||||||
memcpy(wall->tcs, save, sizeof(wall->tcs));
|
memcpy(wall->tcs, save, sizeof(wall->tcs));
|
||||||
wall->vertcount = 0;
|
wall->vertcount = vertcountsave;
|
||||||
|
wall->vertindex = vertindexsave;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -310,6 +310,8 @@ void FDrawInfo::AddWall(GLWall *wall)
|
||||||
bool translucent = !!(wall->flags & GLWall::GLWF_TRANSLUCENT);
|
bool translucent = !!(wall->flags & GLWall::GLWF_TRANSLUCENT);
|
||||||
int list;
|
int list;
|
||||||
|
|
||||||
|
wall->MakeVertices(this, translucent);
|
||||||
|
|
||||||
if (translucent) // translucent walls
|
if (translucent) // translucent walls
|
||||||
{
|
{
|
||||||
if (!gl.legacyMode && mDrawer->FixedColormap == CM_DEFAULT && wall->gltexture != nullptr)
|
if (!gl.legacyMode && mDrawer->FixedColormap == CM_DEFAULT && wall->gltexture != nullptr)
|
||||||
|
@ -318,7 +320,6 @@ void FDrawInfo::AddWall(GLWall *wall)
|
||||||
wall->dynlightindex = GLRenderer->mLights->UploadLights(lightdata);
|
wall->dynlightindex = GLRenderer->mLights->UploadLights(lightdata);
|
||||||
}
|
}
|
||||||
wall->ViewDistance = (r_viewpoint.Pos - (wall->seg->linedef->v1->fPos() + wall->seg->linedef->Delta() / 2)).XY().LengthSquared();
|
wall->ViewDistance = (r_viewpoint.Pos - (wall->seg->linedef->v1->fPos() + wall->seg->linedef->Delta() / 2)).XY().LengthSquared();
|
||||||
wall->MakeVertices(this, true);
|
|
||||||
auto newwall = drawlists[GLDL_TRANSLUCENT].NewWall();
|
auto newwall = drawlists[GLDL_TRANSLUCENT].NewWall();
|
||||||
*newwall = *wall;
|
*newwall = *wall;
|
||||||
}
|
}
|
||||||
|
@ -347,12 +348,12 @@ void FDrawInfo::AddWall(GLWall *wall)
|
||||||
{
|
{
|
||||||
list = masked ? GLDL_MASKEDWALLS : GLDL_PLAINWALLS;
|
list = masked ? GLDL_MASKEDWALLS : GLDL_PLAINWALLS;
|
||||||
}
|
}
|
||||||
wall->MakeVertices(this, false);
|
|
||||||
auto newwall = drawlists[list].NewWall();
|
auto newwall = drawlists[list].NewWall();
|
||||||
*newwall = *wall;
|
*newwall = *wall;
|
||||||
if (!masked) newwall->ProcessDecals(this);
|
if (!masked) newwall->ProcessDecals(this);
|
||||||
}
|
}
|
||||||
wall->dynlightindex = -1;
|
wall->dynlightindex = -1;
|
||||||
|
wall->vertcount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -1704,7 +1704,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PointOnSide(FVector3 &v) { return PointOnSide(v.X, v.Y, v.Z); }
|
bool PointOnSide(FVector3 &v) { return PointOnSide(v.X, v.Y, v.Z); }
|
||||||
bool ValidNormal() { return m_normal.LengthSquared() == 1.f; }
|
|
||||||
|
|
||||||
float A() { return m_normal.X; }
|
float A() { return m_normal.X; }
|
||||||
float B() { return m_normal.Y; }
|
float B() { return m_normal.Y; }
|
||||||
|
|
Loading…
Reference in New Issue