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>
|
|
|
|
|
/// Each of this structs describes a texture. The name of the
|
|
|
|
|
/// texture is a string and may be 16 characters long (including
|
|
|
|
|
/// the null-character at the end, char equals a 8bit signed
|
|
|
|
|
/// integer). The name of the texture is needed, if the texture
|
|
|
|
|
/// has to be found and loaded from an external WAD file.
|
|
|
|
|
/// Furthermore, the struct contains the width and height of
|
|
|
|
|
/// the texture. The 4 offsets at the end can either be zero,
|
|
|
|
|
/// if the texture is stored in an external WAD file, or point
|
|
|
|
|
/// to the beginnings of the binary texture data within the
|
|
|
|
|
/// texture lump relative to the beginning of it's BSPMIPTEX struct.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
|
2025-10-30 21:21:56 -04:00
|
|
|
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
|
2025-09-26 10:57:15 -04:00
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public sealed class MipTexture
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Name of texture
|
|
|
|
|
/// </summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.MAXTEXTURENAME)]
|
2025-10-31 13:59:28 -04:00
|
|
|
public string Name = string.Empty;
|
2025-10-30 21:21:56 -04:00
|
|
|
|
2025-09-26 10:57:15 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Extends of the texture
|
|
|
|
|
/// </summary>
|
|
|
|
|
public uint Width;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Extends of the texture
|
|
|
|
|
/// </summary>
|
|
|
|
|
public uint Height;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Offsets to texture mipmaps BSPMIPTEX
|
|
|
|
|
/// </summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MIPLEVELS)]
|
2025-10-31 13:59:28 -04:00
|
|
|
public uint[] Offsets = new uint[Constants.MIPLEVELS];
|
2025-09-26 10:57:15 -04:00
|
|
|
}
|
2025-10-30 21:21:56 -04:00
|
|
|
}
|