Fix incorrect lightmap scale multiplier
This commit is contained in:
parent
bb617ffc52
commit
cbf309aaa4
|
@ -29,6 +29,16 @@ public class WorldRep : IChunk
|
||||||
DataSize = reader.ReadUInt32();
|
DataSize = reader.ReadUInt32();
|
||||||
CellCount = 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
|
public struct Cell
|
||||||
|
|
|
@ -267,7 +267,7 @@ public partial class Mission : Node3D
|
||||||
|
|
||||||
var renderPoly = cell.RenderPolys[polyIdx];
|
var renderPoly = cell.RenderPolys[polyIdx];
|
||||||
var light = cell.LightList[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);
|
var textureId = CalcBaseUV(cell, poly, renderPoly, light, textureUvs, lightmapUvs, lightmapScale, indicesOffset);
|
||||||
|
|
||||||
if (!surfaceDataMap.ContainsKey(textureId))
|
if (!surfaceDataMap.ContainsKey(textureId))
|
||||||
|
|
Loading…
Reference in New Issue