mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
- fixed cherry-picked commit so that modern OpenGL can still do the light setup in the render pass.
This commit is contained in:
parent
a9c8546ba3
commit
acb9505606
3 changed files with 17 additions and 6 deletions
|
@ -112,7 +112,14 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool
|
|||
gl_RenderState.Apply();
|
||||
auto iboindex = flat->iboindex;
|
||||
|
||||
if (processlights) gl_RenderState.ApplyLightIndex(flat->dynlightindex);
|
||||
if (processlights)
|
||||
{
|
||||
if (screen->hwcaps & RFL_BUFFER_STORAGE)
|
||||
{
|
||||
flat->SetupLights(this, flat->sector->lighthead, lightdata, flat->sector->PortalGroup);
|
||||
}
|
||||
gl_RenderState.ApplyLightIndex(flat->dynlightindex);
|
||||
}
|
||||
|
||||
if (iboindex >= 0)
|
||||
{
|
||||
|
@ -215,13 +222,13 @@ void FDrawInfo::DrawFlat(GLFlat *flat, int pass, bool trans) // trans only has m
|
|||
{
|
||||
gl_RenderState.SetMaterial(flat->gltexture, CLAMP_NONE, 0, -1, false);
|
||||
gl_RenderState.SetPlaneTextureRotation(&plane, flat->gltexture);
|
||||
DrawSubsectors(flat, pass, processLights && (gl.lightmethod == LM_DIRECT || flat->dynlightindex > -1), false);
|
||||
DrawSubsectors(flat, pass, processLights, false);
|
||||
gl_RenderState.EnableTextureMatrix(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_RenderState.SetMaterial(flat->gltexture, CLAMP_XY, 0, -1, false);
|
||||
DrawSkyboxSector(flat, pass, processLights && (gl.lightmethod == LM_DIRECT || flat->dynlightindex > -1));
|
||||
DrawSkyboxSector(flat, pass, processLights);
|
||||
}
|
||||
gl_RenderState.SetObjectColor(0xffffffff);
|
||||
break;
|
||||
|
|
|
@ -139,6 +139,7 @@ void GLFlat::SetupLights(HWDrawInfo *di, FLightNode * node, FDynLightData &light
|
|||
{
|
||||
Plane p;
|
||||
|
||||
lightdata.Clear();
|
||||
if (renderstyle == STYLE_Add && !level.lightadditivesurfaces)
|
||||
{
|
||||
dynlightindex = -1;
|
||||
|
@ -182,14 +183,16 @@ void GLFlat::SetupLights(HWDrawInfo *di, FLightNode * node, FDynLightData &light
|
|||
|
||||
inline void GLFlat::PutFlat(HWDrawInfo *di, bool fog)
|
||||
{
|
||||
|
||||
if (di->isFullbrightScene())
|
||||
{
|
||||
Colormap.Clear();
|
||||
}
|
||||
else if (level.HasDynamicLights && gltexture != nullptr)
|
||||
else if (!(screen->hwcaps & RFL_BUFFER_STORAGE))
|
||||
{
|
||||
SetupLights(di, sector->lighthead, lightdata, sector->PortalGroup);
|
||||
if (level.HasDynamicLights && gltexture != nullptr)
|
||||
{
|
||||
SetupLights(di, sector->lighthead, lightdata, sector->PortalGroup);
|
||||
}
|
||||
}
|
||||
di->AddFlat(this, fog);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ enum EHWCaps
|
|||
|
||||
RFL_SHADER_STORAGE_BUFFER = 4,
|
||||
RFL_BUFFER_STORAGE = 8,
|
||||
RFL_NO_LIGHT_PREGENERATE = 16, // delays dynamic light creation until the render pass. With modern OpenGL this is faster because it can make use of the CPU while the GPU is rendering.
|
||||
|
||||
RFL_NO_CLIP_PLANES = 32,
|
||||
|
||||
|
|
Loading…
Reference in a new issue