Files

49 lines
1.8 KiB
C#
Raw Permalink Normal View History

2025-09-26 10:57:15 -04:00
using System.Runtime.InteropServices;
2025-09-26 13:06:18 -04:00
namespace SabreTools.Data.Models.BSP
2025-09-26 10:57:15 -04:00
{
/// <summary>
/// Unlike the simpler decals (infodecal entities), info_overlays
/// are removed from the entity lump and stored separately in the
2025-10-30 21:21:56 -04:00
/// Overlay lump (Lump 45).
///
2025-09-26 10:57:15 -04:00
/// The FaceCountAndRenderOrder member is split into two parts;
/// the lower 14 bits are the number of faces that the overlay
/// appears on, with the top 2 bits being the render order of
/// the overlay (for overlapping decals). The Ofaces array, which
/// is 64 elements in size (OVERLAY_BSP_FACE_COUNT) are the indices
/// into the face array indicating which map faces the overlay
/// should be displayed on. The other elements set the texture,
/// scale, and orientation of the overlay decal. There is no
/// enforced limit on overlays inside the engine. VBSP enforces
/// a limit of 512 (MAX_MAP_OVERLAYS, 1024 in Counter-Strike:
2025-10-30 21:21:56 -04:00
/// Global Offensive), but custom compilers can circumvent this.
2025-09-26 10:57:15 -04:00
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Overlay
{
public int Id;
public short TexInfo;
public ushort FaceCountAndRenderOrder;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.OVERLAY_BSP_FACE_COUNT)]
2025-10-30 21:21:56 -04:00
public int[] Ofaces = new int[Constants.OVERLAY_BSP_FACE_COUNT];
2025-09-26 10:57:15 -04:00
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
2025-10-30 21:21:56 -04:00
public float[] U = new float[2];
2025-09-26 10:57:15 -04:00
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
2025-10-30 21:21:56 -04:00
public float[] V = new float[2];
2025-09-26 10:57:15 -04:00
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
2025-10-30 21:21:56 -04:00
public Vector3D[] UVPoints = new Vector3D[4];
2025-09-26 10:57:15 -04:00
public Vector3D Origin = new();
2025-09-26 10:57:15 -04:00
public Vector3D BasisNormal = new();
2025-09-26 10:57:15 -04:00
}
2025-10-30 21:21:56 -04:00
}