From 59f1ef9a1e6823dc3785386ac97a7b2ca9699e00 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Tue, 9 Aug 2016 20:55:28 -0600 Subject: [PATCH] light: bounce: only save style 0 lightmap if some traces hit --- light/ltface.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/light/ltface.cc b/light/ltface.cc index d0e3d2ae..2e9ac2ef 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -1841,6 +1841,8 @@ LightFace_Bounce(const bsp2_t *bsp, const bsp2_dface_t *face, const lightsurf_t /* use a style 0 light map */ lightmap = Lightmap_ForStyle(lightmaps, 0, lightsurf); + bool hit = false; + for (const bouncelight_t &vpl : BounceLights()) { if (VisCullEntity(bsp, lightsurf->pvs, vpl.leaf)) continue; @@ -1889,12 +1891,13 @@ LightFace_Bounce(const bsp2_t *bsp, const bsp2_dface_t *face, const lightsurf_t lightsample_t *sample = &lightmap->samples[i]; VectorAdd(sample->color, indirect, sample->color); + hit = true; total_bounce_ray_hits++; } } - // FIXME: check if (hit) - Lightmap_Save(lightmaps, lightsurf, lightmap, 0); + if (hit) + Lightmap_Save(lightmaps, lightsurf, lightmap, 0); }