Add support for 007 Nightfire normals lump

This commit is contained in:
William Fowler
2021-09-28 12:03:50 -06:00
parent 83d23fe599
commit 530750e5d0
2 changed files with 32 additions and 0 deletions

View File

@@ -237,6 +237,22 @@ namespace LibBSP {
}
}
/// <summary>
/// Gets the index for the vertex normals lump in the BSP file for a specific map format.
/// </summary>
/// <param name="type">The map type.</param>
/// <returns>Index for this lump, or -1 if the format doesn't have this lump.</returns>
public static int GetIndexForNormalsLump(MapType type) {
switch (type) {
case MapType.Nightfire: {
return 5;
}
default: {
return -1;
}
}
}
/// <summary>
/// Gets the index for the patch vertices lump in the BSP file for a specific map format.
/// </summary>

View File

@@ -111,6 +111,7 @@ namespace LibBSP {
// Nightfire
private Textures _materials;
private NumList _indices;
private Lump<Vertex> _normals;
// Source
private Lump<Face> _originalFaces;
private NumList _texTable;
@@ -208,6 +209,21 @@ namespace LibBSP {
}
}
/// <summary>
/// A <see cref="Lump{Vertex}"/> of <see cref="Vertex"/> objects in the BSP file representing the vertex normals of the BSP, if available.
/// </summary>
public Lump<Vertex> normals {
get {
if (_normals == null) {
int index = VertexExtensions.GetIndexForNormalsLump(version);
if (index >= 0) {
_normals = VertexExtensions.LumpFactory(reader.ReadLump(this[index]), this, this[index]);
}
}
return _normals;
}
}
/// <summary>
/// A <see cref="Lump{Node}"/> of <see cref="Node"/> objects in the BSP file, if available.
/// </summary>