diff --git a/project/code/LGS/Database/Chunks/WorldRep.cs b/project/code/LGS/Database/Chunks/WorldRep.cs index 74ca946..63967fc 100644 --- a/project/code/LGS/Database/Chunks/WorldRep.cs +++ b/project/code/LGS/Database/Chunks/WorldRep.cs @@ -29,6 +29,16 @@ public class WorldRep : IChunk DataSize = reader.ReadUInt32(); CellCount = reader.ReadUInt32(); } + + public readonly float LightmapScaleMultiplier() + { + return Math.Sign(LightmapScale) switch + { + 1 => LightmapScale, + -1 => 1.0f / LightmapScale, + _ => 1.0f, + }; + } } public struct Cell diff --git a/project/code/TMV/Mission.cs b/project/code/TMV/Mission.cs index 7b78975..9fa1c3c 100644 --- a/project/code/TMV/Mission.cs +++ b/project/code/TMV/Mission.cs @@ -267,7 +267,7 @@ public partial class Mission : Node3D var renderPoly = cell.RenderPolys[polyIdx]; var light = cell.LightList[polyIdx]; - var lightmapScale = worldRep.DataHeader.LightmapScale; + var lightmapScale = worldRep.DataHeader.LightmapScaleMultiplier(); var textureId = CalcBaseUV(cell, poly, renderPoly, light, textureUvs, lightmapUvs, lightmapScale, indicesOffset); if (!surfaceDataMap.ContainsKey(textureId))