From 8c988c1ce31b9ad4e54643d9da8a43a41371409f Mon Sep 17 00:00:00 2001 From: Daniel Walder Date: Mon, 29 Jan 2024 17:07:29 +1000 Subject: [PATCH] Add ID to faces, add RawLightmapData to Lighmaps lump --- Sledge.Formats.Bsp/Lumps/Faces.cs | 2 ++ Sledge.Formats.Bsp/Lumps/Lightmaps.cs | 2 ++ Sledge.Formats.Bsp/Objects/Face.cs | 1 + Sledge.Formats.Bsp/Sledge.Formats.Bsp.csproj | 4 ++-- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Sledge.Formats.Bsp/Lumps/Faces.cs b/Sledge.Formats.Bsp/Lumps/Faces.cs index 4f28ddd..21aac32 100644 --- a/Sledge.Formats.Bsp/Lumps/Faces.cs +++ b/Sledge.Formats.Bsp/Lumps/Faces.cs @@ -16,10 +16,12 @@ public Faces() public void Read(BinaryReader br, Blob blob, Version version) { + var i = 0u; while (br.BaseStream.Position < blob.Offset + blob.Length) { var face = new Face { + ID = i++, Plane = br.ReadUInt16(), Side = br.ReadUInt16(), FirstEdge = br.ReadInt32(), diff --git a/Sledge.Formats.Bsp/Lumps/Lightmaps.cs b/Sledge.Formats.Bsp/Lumps/Lightmaps.cs index 24f3f3a..2bbffff 100644 --- a/Sledge.Formats.Bsp/Lumps/Lightmaps.cs +++ b/Sledge.Formats.Bsp/Lumps/Lightmaps.cs @@ -13,6 +13,8 @@ public class Lightmaps : ILump, IList private readonly IList _lightmaps; private byte[] _lightmapData; + public byte[] RawLightmapData => _lightmapData; + public Lightmaps() { _lightmaps = new List(); diff --git a/Sledge.Formats.Bsp/Objects/Face.cs b/Sledge.Formats.Bsp/Objects/Face.cs index a40cf68..40d4bc6 100644 --- a/Sledge.Formats.Bsp/Objects/Face.cs +++ b/Sledge.Formats.Bsp/Objects/Face.cs @@ -4,6 +4,7 @@ public class Face { public const int MaxLightmaps = 4; + public uint ID { get; set; } public ushort Plane { get; set; } public ushort Side { get; set; } public int FirstEdge { get; set; } diff --git a/Sledge.Formats.Bsp/Sledge.Formats.Bsp.csproj b/Sledge.Formats.Bsp/Sledge.Formats.Bsp.csproj index 26874ef..5d80089 100644 --- a/Sledge.Formats.Bsp/Sledge.Formats.Bsp.csproj +++ b/Sledge.Formats.Bsp/Sledge.Formats.Bsp.csproj @@ -11,8 +11,8 @@ https://github.com/LogicAndTrick/sledge-formats Git half-life quake valve bsp - Improve traceline implementation - 1.0.14 + Add ID to faces, add RawLightmapData to Lighmaps lump + 1.0.15