using System.Runtime.InteropServices; namespace SabreTools.Data.Models.BSP { /// /// The leaves lump contains the leaves of the BSP tree. /// /// The first entry of this struct is the type of the content /// of this leaf. It can be one of the predefined values, found /// in the compiler source codes, and is litte relevant for the /// actual rendering process. All the more important is the /// next integer containing the offset into the vis lump. It /// defines the start of the raw PVS data for this leaf. If this /// value equals -1, no VIS lists are available for this leaf, /// usually if the map has been built without the VIS compiler. /// The next two 16bit integer triples span the bounding box of /// this leaf. Furthermore, the struct contains an index pointing /// into the array of marksurfaces loaded from the marksufaces /// lump as well as the number of consecutive marksurfaces belonging /// to this leaf. The marksurfaces are looped through during the /// rendering process and point to the actual faces. The final 4 bytes /// specify the volume of ambient sounds in Quake, but are unused in /// GoldSrc. /// /// public sealed class VbspLeaf { /// /// Contents enumeration /// public VbspContents Contents; /// /// Cluster this leaf is in /// public short Cluster; /// /// Area this leaf is in and flags /// /// area:9, flags:7 public short AreaFlags; /// /// For frustum culling /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public short[] Mins = new short[3]; /// /// For frustum culling /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public short[] Maxs = new short[3]; /// /// Index into leaffaces /// public ushort FirstLeafFace; /// /// Count of leaffaces /// public ushort NumLeafFaces; /// /// Index into leafbrushes /// public ushort FirstLeafBrush; /// /// Count of leafbrushes /// public ushort NumLeafBrushes; /// /// -1 for not in water /// public short LeafWaterDataID; #region Lump Version 0 /// /// Precaculated light info for entities. /// public CompressedLightCube AmbientLighting = new(); #endregion #region Lump Version 1+ /// /// Padding to 4-byte boundary /// public short Padding; #endregion } }