Fix edge case where the lightmap lump surface touches the edge of the atlas page
This commit is contained in:
parent
22368c0f40
commit
476c98fdfa
1 changed files with 4 additions and 2 deletions
|
|
@ -3116,7 +3116,7 @@ void MapLoader::LoadLightmap(MapData* map)
|
|||
fr.Read(&zdrayUvs[0], numTexCoords * 2 * sizeof(float));
|
||||
|
||||
// Load lightmap textures
|
||||
Level->levelMesh->LMTextureData.Resize(Level->levelMesh->LMTextureCount* Level->levelMesh->LMTextureSize * Level->levelMesh->LMTextureSize * 3);
|
||||
Level->levelMesh->LMTextureData.Resize(Level->levelMesh->LMTextureCount * Level->levelMesh->LMTextureSize * Level->levelMesh->LMTextureSize * 3);
|
||||
|
||||
TArray<uint16_t> textureData;
|
||||
textureData.Resize((numTexBytes + 1) / 2);
|
||||
|
|
@ -3150,7 +3150,9 @@ void MapLoader::LoadLightmap(MapData* map)
|
|||
int dstPage = realSurface.atlasPageIndex;
|
||||
|
||||
// Sanity checks
|
||||
if (srcMinX < 0 || srcMinY < 0 || dstX < 0 || dstY < 0 || srcMaxX >= textureSize || srcMaxY >= textureSize || dstX + srcW >= textureSize || dstY + srcH >= textureSize || srcPage >= numTextures || dstPage >= Level->levelMesh->LMTextureCount)
|
||||
if (srcMinX < 0 || srcMinY < 0 || srcMaxX > textureSize || srcMaxY > textureSize ||
|
||||
dstX < 0 || dstY < 0 || dstX + srcW > Level->levelMesh->LMTextureSize || dstY + srcH > Level->levelMesh->LMTextureSize ||
|
||||
srcPage >= numTextures || dstPage >= Level->levelMesh->LMTextureCount)
|
||||
{
|
||||
errors = true;
|
||||
if (developer >= 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue