From 0a8965bae066ef31c07e4e6d22e055a6c4eb65dc Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Thu, 21 Apr 2016 00:22:35 -0600 Subject: [PATCH] light: fix lighting with vis data --- light/ltface.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/light/ltface.c b/light/ltface.c index a99dade9..b128c80e 100644 --- a/light/ltface.c +++ b/light/ltface.c @@ -710,7 +710,8 @@ CalcPvs(const bsp2_t *bsp, lightsurf_t *lightsurf) surfpoint = lightsurf->points[0]; for (i = 0; i < lightsurf->numpoints; i++, surfpoint += 3) { const bsp2_dleaf_t *leaf = Light_PointInLeaf (bsp, surfpoint); - + const int leafnum = leaf - bsp->dleafs; + if (leaf == NULL) continue; @@ -726,6 +727,9 @@ CalcPvs(const bsp2_t *bsp, lightsurf_t *lightsurf) else DecompressVis (bsp, bsp->dvisdata + leaf->visofs, bsp->dvisdata + bsp->visdatasize, pointpvs); + /* mark this leaf as visible to itself (why is this not the case in the visdata!?!) */ + pointpvs[leafnum>>3] |= (1<<(leafnum&7)); + /* merge the pvs for this sample point into lightsurf->pvs */ for (j=0; j