mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-28 06:42:09 +00:00
- only draw visible 3D-lights.
This commit is contained in:
parent
bddad29acb
commit
1ad310e69b
1 changed files with 17 additions and 8 deletions
|
@ -344,15 +344,24 @@ void GLWall::RenderTextured(int rflags)
|
||||||
|
|
||||||
for (unsigned i = 0; i < lightlist->Size(); i++)
|
for (unsigned i = 0; i < lightlist->Size(); i++)
|
||||||
{
|
{
|
||||||
int thisll = (*lightlist)[i].caster != NULL? gl_ClampLight(*(*lightlist)[i].p_lightlevel) : lightlevel;
|
secplane_t &lowplane = i == (*lightlist).Size() - 1 ? bottomplane : (*lightlist)[i + 1].plane;
|
||||||
|
// this must use the exact same calculation method as GLWall::Process etc.
|
||||||
|
float low1 = FIXED2FLOAT(lowplane.ZatPoint(vertexes[0]));
|
||||||
|
float low2 = FIXED2FLOAT(lowplane.ZatPoint(vertexes[1]));
|
||||||
|
|
||||||
|
if (low1 < ztop[0] && low2 < ztop[1])
|
||||||
|
{
|
||||||
|
int thisll = (*lightlist)[i].caster != NULL ? gl_ClampLight(*(*lightlist)[i].p_lightlevel) : lightlevel;
|
||||||
FColormap thiscm;
|
FColormap thiscm;
|
||||||
thiscm.FadeColor = Colormap.FadeColor;
|
thiscm.FadeColor = Colormap.FadeColor;
|
||||||
thiscm.CopyFrom3DLight(&(*lightlist)[i]);
|
thiscm.CopyFrom3DLight(&(*lightlist)[i]);
|
||||||
gl_SetColor(thisll, rel, thiscm, absalpha);
|
gl_SetColor(thisll, rel, thiscm, absalpha);
|
||||||
if (type != RENDERWALL_M2SNF) gl_SetFog(thisll, rel, &thiscm, RenderStyle == STYLE_Add);
|
if (type != RENDERWALL_M2SNF) gl_SetFog(thisll, rel, &thiscm, RenderStyle == STYLE_Add);
|
||||||
gl_RenderState.SetSplitPlanes((*lightlist)[i].plane, i == (*lightlist).Size() - 1 ? bottomplane : (*lightlist)[i + 1].plane);
|
gl_RenderState.SetSplitPlanes((*lightlist)[i].plane, lowplane);
|
||||||
RenderWall(rflags);
|
RenderWall(rflags);
|
||||||
}
|
}
|
||||||
|
if (low1 <= zbottom[0] && low2 <= zbottom[1]) break;
|
||||||
|
}
|
||||||
|
|
||||||
glDisable(GL_CLIP_DISTANCE3);
|
glDisable(GL_CLIP_DISTANCE3);
|
||||||
glDisable(GL_CLIP_DISTANCE4);
|
glDisable(GL_CLIP_DISTANCE4);
|
||||||
|
|
Loading…
Reference in a new issue