using System.Runtime.InteropServices; namespace SabreTools.Data.Models.BSP { /// /// A model is kind of a mini BSP tree. Its size is determinded /// by the bounding box spaned by the first to members of this /// struct. The major difference between a model and the BSP /// tree holding the scene is that the models use a local /// coordinate system for their vertexes and just state its /// origin in world coordinates. During rendering the coordinate /// system is translated to the origin of the model (glTranslate()) /// and moved back after the models BSP tree has been traversed. /// Furthermore their are 4 indexes into node arrays. The first /// one has proofed to index the root node of the mini BSP tree /// used for rendering. The other three indexes could probably be /// used for collision detection, meaning they point into the /// clipnodes, but I am not sure about this. The meaning of the /// next value is also somehow unclear to me. Finally their are /// direct indexes into the faces array, not taking the redirecting /// by the marksurfaces. /// /// [StructLayout(LayoutKind.Sequential)] public sealed class BspModel { /// /// Defines bounding box /// public Vector3D Mins = new(); /// /// Defines bounding box /// public Vector3D Maxs = new(); /// /// Coordinates to move the coordinate system /// public Vector3D OriginVector = new(); /// /// Index into nodes array /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MAX_MAP_HULLS)] public int[] HeadnodesIndex = new int[Constants.MAX_MAP_HULLS]; /// /// ??? /// public int VisLeafsCount; /// /// Index into faces /// public int FirstFaceIndex; /// /// Count of faces /// public int FacesCount; } }