- make the LIGHTMAP_MAX_SIZE define actually work if someone changes it

This commit is contained in:
Magnus Norddahl 2018-11-03 19:37:50 +01:00
parent ed983935ec
commit 0f6da0df5d
2 changed files with 6 additions and 5 deletions

View file

@ -463,7 +463,7 @@ void kexLightmapBuilder::TraceSurface(surface_t *surface)
} }
kexMath::Clamp(c, 0, 1); 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); int offs = (((textureWidth * (i + surface->lightmapOffs[1])) + surface->lightmapOffs[0]) * 3);
// convert RGB to bytes // convert RGB to bytes
currentTexture[offs + j * 3 + 0] = floatToHalf(colorSamples[i * 1024 + j].x); currentTexture[offs + j * 3 + 0] = floatToHalf(colorSamples[i * LIGHTMAP_MAX_SIZE + j].x);
currentTexture[offs + j * 3 + 1] = floatToHalf(colorSamples[i * 1024 + j].y); currentTexture[offs + j * 3 + 1] = floatToHalf(colorSamples[i * LIGHTMAP_MAX_SIZE + j].y);
currentTexture[offs + j * 3 + 2] = floatToHalf(colorSamples[i * 1024 + j].z); currentTexture[offs + j * 3 + 2] = floatToHalf(colorSamples[i * LIGHTMAP_MAX_SIZE + j].z);
} }
} }
} }

View file

@ -1,6 +1,7 @@
#include "worker.h" #include "worker.h"
#include "math/mathlib.h" #include "math/mathlib.h"
#include "lightmap.h"
#include <vector> #include <vector>
#include <thread> #include <thread>
#include <algorithm> #include <algorithm>
@ -24,7 +25,7 @@ void kexWorker::RunJob(int count, std::function<void(int)> callback)
{ {
threads.push_back(std::thread([=]() { threads.push_back(std::thread([=]() {
std::vector<kexVec3> samples(1024 * 1024); std::vector<kexVec3> samples(LIGHTMAP_MAX_SIZE * LIGHTMAP_MAX_SIZE);
colorSamples = samples.data(); colorSamples = samples.data();
int start = threadIndex * count / numThreads; int start = threadIndex * count / numThreads;