Lightmapper fixes

This commit is contained in:
Magnus Norddahl 2023-12-11 19:29:44 +01:00
commit c59108ece0
3 changed files with 53 additions and 8 deletions

View file

@ -247,9 +247,9 @@ static int CreateIndexedSectorVerticesLM(FRenderState& renderstate, sector_t* se
if (lightmap && lightmap->Type != ST_NONE) // surface may be missing if the subsector is degenerate triangle
{
FFlatVertex* luvs = &lightmap->Submesh->Mesh.Vertices[lightmap->MeshLocation.StartVertIndex];
for (unsigned int j = 0; j < sub->numlines; j++)
for (unsigned int j = 0, end = sub->numlines; j < end; j++)
{
SetFlatVertex(vbo_shadowdata[vi + pos], sub->firstline[j].v1, plane, luvs[j].lu, luvs[j].lv, luvs[j].lindex);
SetFlatVertex(vbo_shadowdata[vi + pos], sub->firstline[j].v1, plane, luvs[end - 1 - j].lu, luvs[end - 1 - j].lv, luvs[end - 1 - j].lindex);
vbo_shadowdata[vi + pos].z += diff;
pos++;
}