Skip to content

Commit 024cf00

Browse files
committed
Fix lighting for movable BSP entities
BSP model surfaces were wrongly flagged with the `bspSurface` bit which only works for fixed-location world surfaces. This flag was causing the code to skip setting up the model matrix for the lightMapping shader, meaning normals and dynamic light positions were not correct. So stop flagging BSP models as `bspSurface`. Also skip the other things in R_AddWorldSurface, besides R_AddDrawSurf, because they are useless or redundant. This means that BSP entities (e.g. doors) will now generally be lit with grid lighting rather than lightmaps. Fixes Unvanquished/Unvanquished#3474.
1 parent 1672200 commit 024cf00

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/engine/renderer/tr_local.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,7 @@ enum
14891489
surfaceType_t *surface; // any of surface*_t
14901490
shader_t *shader;
14911491
uint64_t sort;
1492-
bool bspSurface;
1492+
bool bspSurface; // only for the stationary part of the world, *not* BSP models
14931493
int fog;
14941494
int portalNum = -1;
14951495

src/engine/renderer/tr_world.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ void R_AddBSPModelSurfaces( trRefEntity_t *ent )
194194

195195
for ( i = 0; i < bspModel->numSurfaces; i++ )
196196
{
197-
R_AddWorldSurface( bspModel->firstSurface + i, fogNum, -1, FRUSTUM_CLIPALL );
197+
bspSurface_t *surf = bspModel->firstSurface + i;
198+
R_AddDrawSurf( surf->data, surf->shader, surf->lightmapNum, fogNum );
198199
}
199200
}
200201

0 commit comments

Comments
 (0)