Skip to content

Commit

Permalink
Simplify checks for lightmap.
Browse files Browse the repository at this point in the history
  • Loading branch information
skullernet committed Dec 3, 2023
1 parent f59c8ed commit 8333905
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/refresh/surf.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,7 @@ void GL_PushLights(mface_t *surf)
lightstyle_t *style;
int i;

if (!surf->lightmap) {
return;
}
if (surf->drawflags & gl_static.nolm_mask) {
return;
}
if (!surf->texnum[1]) {
if (!surf->light_m) {
return;
}

Expand Down Expand Up @@ -500,16 +494,9 @@ static void LM_RebuildSurfaces(void)
}

for (i = 0, surf = bsp->faces; i < bsp->numfaces; i++, surf++) {
if (!surf->lightmap) {
continue;
}
if (surf->drawflags & gl_static.nolm_mask) {
continue;
}
if (!surf->texnum[1]) {
continue;
if (surf->light_m) {
build_primary_lightmap(surf);
}
build_primary_lightmap(surf);
}

// upload all lightmaps
Expand Down Expand Up @@ -883,11 +870,12 @@ static void upload_world_surfaces(void)
tess.numverts += surf->numsurfedges;
}

surf->light_m = NULL; // start with no lightmap
surf->firstvert = currvert;
build_surface_poly(surf, vbo);
build_surface_light(surf, vbo);

if (surf->texnum[1])
if (surf->light_m)
normalize_surface_lmtc(surf, vbo);
else
duplicate_surface_lmtc(surf, vbo);
Expand Down

0 comments on commit 8333905

Please sign in to comment.