- implemented rendering of 3D lights with clip planes.

This commit is contained in:
Christoph Oelckers 2016-01-31 22:04:20 +01:00
parent 456e71ec4b
commit 9ce6a7932c
2 changed files with 7 additions and 6 deletions

View file

@ -242,7 +242,7 @@ void GLWall::SplitWall(sector_t * frontsector, bool translucent)
for (unsigned i = 0; i < lightlist.Size(); i++) for (unsigned i = 0; i < lightlist.Size(); i++)
{ {
lights[i].cliptop = &lightlist[i].plane; lights[i].cliptop = &lightlist[i].plane;
lights[i].clipbottom = i == lightlist.Size() - 1 ? &bottomplane : &lightlist[i + 1].plane; lights[i].clipbottom = i == lightlist.Size() - 1 ? (secplane_t*)NULL : &lightlist[i + 1].plane;
lights[i].lightlevel = lightlist[i].caster != NULL? gl_ClampLight(*lightlist[i].p_lightlevel) : lightlevel; lights[i].lightlevel = lightlist[i].caster != NULL? gl_ClampLight(*lightlist[i].p_lightlevel) : lightlevel;
lights[i].colormap.FadeColor = Colormap.FadeColor; lights[i].colormap.FadeColor = Colormap.FadeColor;
lights[i].colormap.CopyFrom3DLight(&lightlist[i]); lights[i].colormap.CopyFrom3DLight(&lightlist[i]);

View file

@ -338,17 +338,18 @@ void GLWall::RenderTextured(int rflags)
} }
else else
{ {
unsigned int store[2];
//RenderWall(rflags, store);
gl_RenderState.EnableSplit(true); gl_RenderState.EnableSplit(true);
for (unsigned i = 0; i < lightsize; i++) glEnable(GL_CLIP_DISTANCE3);
glEnable(GL_CLIP_DISTANCE4);
for (unsigned i = 0; i <lightsize; i++)
{ {
gl_SetColor(lights[i].lightlevel, rel, lights[i].colormap, absalpha); gl_SetColor(lights[i].lightlevel, rel, lights[i].colormap, absalpha);
if (type != RENDERWALL_M2SNF) gl_SetFog(lights[i].lightlevel, rel, &lights[i].colormap, RenderStyle == STYLE_Add); if (type != RENDERWALL_M2SNF) gl_SetFog(lights[i].lightlevel, rel, &lights[i].colormap, RenderStyle == STYLE_Add);
gl_RenderState.SetSplitPlanes(*lights[i].cliptop, *lights[i].clipbottom); gl_RenderState.SetSplitPlanes(*lights[i].cliptop, lights[i].clipbottom? *lights[i].clipbottom : bottomplane);
//GLRenderer->mVBO->RenderArray(GL_TRIANGLE_FAN, store[0], store[1]);
RenderWall(rflags); RenderWall(rflags);
} }
glDisable(GL_CLIP_DISTANCE3);
glDisable(GL_CLIP_DISTANCE4);
gl_RenderState.EnableSplit(false); gl_RenderState.EnableSplit(false);
} }
gl_RenderState.SetTextureMode(tmode); gl_RenderState.SetTextureMode(tmode);