mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-21 19:41:11 +00:00
Round sampledist to power of 2
This commit is contained in:
parent
18a873923f
commit
fd4496f360
2 changed files with 12 additions and 2 deletions
|
@ -59,7 +59,7 @@ struct LevelMeshSurface
|
|||
int sectorGroup = 0;
|
||||
|
||||
BBox bounds;
|
||||
int sampleDimension = 0;
|
||||
uint16_t sampleDimension = 0;
|
||||
|
||||
// Lightmap world coordinates for the texture
|
||||
FVector3 worldOrigin = { 0.f, 0.f, 0.f };
|
||||
|
|
|
@ -893,7 +893,17 @@ void DoomLevelMesh::BuildSurfaceParams(int lightMapTextureWidth, int lightMapTex
|
|||
{
|
||||
surface.sampleDimension = LightmapSampleDistance;
|
||||
}
|
||||
//surface->sampleDimension = Math::RoundPowerOfTwo(surface->sampleDimension);
|
||||
|
||||
{
|
||||
// Round to nearest power of two
|
||||
uint32_t n = uint16_t(surface.sampleDimension);
|
||||
n |= n >> 1;
|
||||
n |= n >> 2;
|
||||
n |= n >> 4;
|
||||
n |= n >> 8;
|
||||
++n;
|
||||
surface.sampleDimension = uint16_t(n) ? uint16_t(n) : uint16_t(0xFFFF);
|
||||
}
|
||||
|
||||
// round off dimensions
|
||||
for (int i = 0; i < 3; i++)
|
||||
|
|
Loading…
Reference in a new issue