Fix surface index passed to glsl

This commit is contained in:
RaveYard 2023-09-08 23:55:03 +02:00 committed by Magnus Norddahl
commit 6ccb92ef60
8 changed files with 67 additions and 30 deletions

View file

@ -194,7 +194,11 @@ void HWFlat::DrawSubsectors(HWDrawInfo *di, FRenderState &state)
for (auto& subsector : section->subsectors)
{
state.PushVisibleSurface(subsector->lightmap[ceiling ? 1 : 0][0]);
auto lightmap = subsector->lightmap[ceiling ? 1 : 0][0];
if (lightmap)
{
state.PushVisibleSurface(lightmap - &subsector->sector->Level->levelMesh->Surfaces[0], lightmap);
}
}
state.DrawIndexed(DT_Triangles, iboindex + section->vertexindex, section->vertexcount);

View file

@ -347,7 +347,11 @@ void HWWall::DrawWall(HWDrawInfo *di, FRenderState &state, bool translucent)
MakeVertices(di, state, !!(flags & HWWall::HWF_TRANSLUCENT));
}
state.PushVisibleSurface(lightmap);
if (lightmap)
{
state.PushVisibleSurface(lightmap - &seg->Subsector->sector->Level->levelMesh->Surfaces[0], lightmap);
}
state.SetNormal(glseg.Normal());
if (!translucent)
{