Files
Matt Nadareski 7689c6dd07 Libraries
This change looks dramatic, but it's just separating out the already-split namespaces into separate top-level folders. In theory, every single one could be built into their own Nuget package. `SabreTools.Serialization` still builds the normal Nuget package that is used by all other projects and includes all namespaces.
2026-03-21 16:26:56 -04:00

106 lines
2.9 KiB
C#

using System.Runtime.InteropServices;
namespace SabreTools.Data.Models.BSP
{
/// <summary>
/// The face lump (Lump 7) contains the major geometry of the map,
/// used by the game engine to render the viewpoint of the player.
/// The face lump contains faces after they have undergone the BSP
/// splitting process; they therefore do not directly correspond to
/// the faces of brushes created in Hammer. Faces are always flat,
/// convex polygons, though they can contain edges that are co-linear.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class VbspFace
{
/// <summary>
/// The plane number
/// </summary>
public ushort PlaneNum;
/// <summary>
/// Faces opposite to the node's plane direction
/// </summary>
public byte Side;
/// <summary>
/// of on node, 0 if in leaf
/// </summary>
public byte OnNode;
/// <summary>
/// Index of the first surfedge
/// </summary>
public int FirstEdgeIndex;
/// <summary>
/// Number of consecutive surfedges
/// </summary>
public short NumberOfEdges;
/// <summary>
/// Index of the texture info structure
/// </summary>
public short TextureInfoIndex;
/// <summary>
/// Index of the displacement info structure
/// </summary>
public short DisplacementInfoIndex;
/// <summary>
/// ?
/// </summary>
public short SurfaceFogVolumeID;
/// <summary>
/// Switchable lighting info
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public byte[] Styles = new byte[4];
/// <summary>
/// Offset into lightmap lump
/// </summary>
public int LightmapOffset;
/// <summary>
/// Face area in units^2
/// </summary>
public float Area;
/// <summary>
/// Texture lighting info
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public int[] LightmapTextureMinsInLuxels = new int[2];
/// <summary>
/// Texture lighting info
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public int[] LightmapTextureSizeInLuxels = new int[2];
/// <summary>
/// Original face this was split from
/// </summary>
public int OrigFace;
/// <summary>
/// Primitives
/// </summary>
public ushort PrimitiveCount;
/// <summary>
/// First primitive ID
/// </summary>
public ushort FirstPrimitiveID;
/// <summary>
/// Lightmap smoothing group
/// </summary>
public uint SmoothingGroups;
}
}