using System.Runtime.InteropServices;
namespace SabreTools.Data.Models.BSP
{
///
/// 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.
///
///
[StructLayout(LayoutKind.Sequential)]
public sealed class VbspFace
{
///
/// The plane number
///
public ushort PlaneNum;
///
/// Faces opposite to the node's plane direction
///
public byte Side;
///
/// of on node, 0 if in leaf
///
public byte OnNode;
///
/// Index of the first surfedge
///
public int FirstEdgeIndex;
///
/// Number of consecutive surfedges
///
public short NumberOfEdges;
///
/// Index of the texture info structure
///
public short TextureInfoIndex;
///
/// Index of the displacement info structure
///
public short DisplacementInfoIndex;
///
/// ?
///
public short SurfaceFogVolumeID;
///
/// Switchable lighting info
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public byte[] Styles = new byte[4];
///
/// Offset into lightmap lump
///
public int LightmapOffset;
///
/// Face area in units^2
///
public float Area;
///
/// Texture lighting info
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public int[] LightmapTextureMinsInLuxels = new int[2];
///
/// Texture lighting info
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public int[] LightmapTextureSizeInLuxels = new int[2];
///
/// Original face this was split from
///
public int OrigFace;
///
/// Primitives
///
public ushort PrimitiveCount;
///
/// First primitive ID
///
public ushort FirstPrimitiveID;
///
/// Lightmap smoothing group
///
public uint SmoothingGroups;
}
}