diff --git a/src/lightmap/lightmap.cpp b/src/lightmap/lightmap.cpp index ed44dbd..410ce0e 100644 --- a/src/lightmap/lightmap.cpp +++ b/src/lightmap/lightmap.cpp @@ -463,7 +463,7 @@ void kexLightmapBuilder::TraceSurface(surface_t *surface) } kexMath::Clamp(c, 0, 1); - colorSamples[i * 1024 + j] = c; + colorSamples[i * LIGHTMAP_MAX_SIZE + j] = c; } } @@ -525,9 +525,9 @@ void kexLightmapBuilder::TraceSurface(surface_t *surface) int offs = (((textureWidth * (i + surface->lightmapOffs[1])) + surface->lightmapOffs[0]) * 3); // convert RGB to bytes - currentTexture[offs + j * 3 + 0] = floatToHalf(colorSamples[i * 1024 + j].x); - currentTexture[offs + j * 3 + 1] = floatToHalf(colorSamples[i * 1024 + j].y); - currentTexture[offs + j * 3 + 2] = floatToHalf(colorSamples[i * 1024 + j].z); + currentTexture[offs + j * 3 + 0] = floatToHalf(colorSamples[i * LIGHTMAP_MAX_SIZE + j].x); + currentTexture[offs + j * 3 + 1] = floatToHalf(colorSamples[i * LIGHTMAP_MAX_SIZE + j].y); + currentTexture[offs + j * 3 + 2] = floatToHalf(colorSamples[i * LIGHTMAP_MAX_SIZE + j].z); } } } diff --git a/src/lightmap/worker.cpp b/src/lightmap/worker.cpp index a4a86df..b73882e 100644 --- a/src/lightmap/worker.cpp +++ b/src/lightmap/worker.cpp @@ -1,6 +1,7 @@ #include "worker.h" #include "math/mathlib.h" +#include "lightmap.h" #include #include #include @@ -24,7 +25,7 @@ void kexWorker::RunJob(int count, std::function callback) { threads.push_back(std::thread([=]() { - std::vector samples(1024 * 1024); + std::vector samples(LIGHTMAP_MAX_SIZE * LIGHTMAP_MAX_SIZE); colorSamples = samples.data(); int start = threadIndex * count / numThreads;