From af2e8ae40483a5d9475e94e1758db99a2fa89f39 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sun, 5 Feb 2023 23:09:05 -0700 Subject: [PATCH] light: hack for sky + LIGHTGRID lump just sample the sunlight omnidirectionally --- light/ltface.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/light/ltface.cc b/light/ltface.cc index 71b54c2e..14d16f7a 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -1939,17 +1939,23 @@ LightPoint_SurfaceLight(const mbsp_t *bsp, raystream_occlusion_t &rs, const std: qvec3f indirect{}; - for (int axis = 0; axis < 3; ++axis) { - for (int sign = -1; sign <= +1; sign += 2) { + if (vpl.omnidirectional) { + // HACK: receive light omnidirectionally + indirect = GetSurfaceLighting(cfg, &vpl, dir, dist, {0, 0, 0}, false, standard_scale, sky_scale, hotspot_clamp); + } else { + for (int axis = 0; axis < 3; ++axis) { + for (int sign = -1; sign <= +1; sign += 2) { - qvec3f cube_color; + qvec3f cube_color; - qvec3f cube_normal{}; - cube_normal[axis] = sign; + qvec3f cube_normal{}; + cube_normal[axis] = sign; - cube_color = GetSurfaceLighting(cfg, &vpl, dir, dist, cube_normal, true, standard_scale, sky_scale, hotspot_clamp); + cube_color = GetSurfaceLighting( + cfg, &vpl, dir, dist, cube_normal, true, standard_scale, sky_scale, hotspot_clamp); - indirect += cube_color / 6.0; + indirect += cube_color / 6.0; + } } }