From 9edadf93cdc0f44528b8d85ef3e4134a6dbd080b Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 2 Nov 2022 01:16:36 -0600 Subject: [PATCH] light: CalcPoints: use faceextents_t::LMCoordToWorld --- light/ltface.cc | 9 +++++---- tests/test_ltface.cc | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/light/ltface.cc b/light/ltface.cc index bbc71618..9b435951 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -388,9 +388,10 @@ static void CalcPoints( surf->width = surf->extents.width() * light_options.extra.value(); surf->height = surf->extents.height() * light_options.extra.value(); - const float starts = (surf->extents.texmins[0] - 0.5 + (0.5 / light_options.extra.value())) * surf->lightmapscale; - const float startt = (surf->extents.texmins[1] - 0.5 + (0.5 / light_options.extra.value())) * surf->lightmapscale; - const float st_step = surf->lightmapscale / light_options.extra.value(); + + const float starts = -0.5 + (0.5 / light_options.extra.value()); + const float startt = -0.5 + (0.5 / light_options.extra.value()); + const float st_step = 1.0f / light_options.extra.value(); /* Allocate surf->points */ size_t num_points = surf->width * surf->height; @@ -412,7 +413,7 @@ static void CalcPoints( const vec_t us = starts + s * st_step; const vec_t ut = startt + t * st_step; - point = surf->extents.texCoordToWorld(qvec2f(us, ut)) + + point = surf->extents.LMCoordToWorld(qvec2f(us, ut)) + surf->plane.normal; // one unit in front of face // do this before correcting the point, so we can wrap around the inside of pipes diff --git a/tests/test_ltface.cc b/tests/test_ltface.cc index 14593d05..403df549 100644 --- a/tests/test_ltface.cc +++ b/tests/test_ltface.cc @@ -36,6 +36,7 @@ static void LoadTestmap(const std::filesystem::path &name, std::vector light_args{ "", // the exe path, which we're ignoring in this case + "-extra", bsp_path.string() }; light_main(light_args);