Add empty constructors to MAP classes. These will be used with object initializers.

This commit is contained in:
Will
2015-10-28 22:46:37 -06:00
parent 189784c85c
commit d174843ce9
4 changed files with 30 additions and 14 deletions

View File

@@ -6,19 +6,25 @@ using System.Collections.Generic;
namespace LibBSP {
/// <summary>
/// Class containing all data for a single brush, including side definitions or a patch definition
/// Class containing all data for a single brush, including side definitions or a patch definition.
/// </summary>
public class MAPBrush {
public List<MAPBrushSide> sides = new List<MAPBrushSide>(6);
public MAPPatch patch;
public bool isDetail { get; private set; }
public bool isDetail = false;
public bool isWater = false;
/// <summary>
/// Creates a new <c>MAPBrush</c> object using the supplied <c>string</c> array as data
/// Creates a new empty <c>MAPBrush</c> object. Internal data will have to be set manually.
/// </summary>
/// <param name="lines">Data to parse</param>
public MAPBrush() { }
/// <summary>
/// Creates a new <c>MAPBrush</c> object using the supplied <c>string</c> array as data.
/// </summary>
/// <param name="lines">Data to parse.</param>
public MAPBrush(string[] lines) {
int braceCount = 0;
bool brushDef3 = false;

View File

@@ -13,7 +13,7 @@ namespace LibBSP {
using Vector3 = Vector3d;
#endif
/// <summary>
/// Class containing data for a brush side. Please note vertices must be set manually or generated through CSG
/// Class containing data for a brush side. Please note vertices must be set manually or generated through CSG.
/// </summary>
public class MAPBrushSide {
@@ -34,10 +34,15 @@ namespace LibBSP {
public int id;
public MAPDisplacement displacement;
/// <summary>
/// Creates a new empty <c>MAPBrushSide</c> object. Internal data will have to be set manually.
/// </summary>
public MAPBrushSide() { }
/// <summary>
/// Constructs a <c>MAPBrushSide</c> object using the provided <c>string</c> array as the data.
/// </summary>
/// <param name="lines">Data to parse</param>
/// <param name="lines">Data to parse.</param>
public MAPBrushSide(string[] lines) {
// If lines.Length is 1, then this line contains all data for a brush side
if (lines.Length == 1) {

View File

@@ -16,7 +16,7 @@ namespace LibBSP {
/// <summary>
/// Class containing all data necessary to render a displacement from Source engine.
/// </summary>
public struct MAPDisplacement {
public class MAPDisplacement {
public int power;
public Vector3 start;
@@ -24,16 +24,16 @@ namespace LibBSP {
public float[][] distances;
public float[][] alphas;
/// <summary>
/// Creates a new empty <c>MAPDisplacement</c> object. Internal data will have to be set manually.
/// </summary>
public MAPDisplacement() { }
/// <summary>
/// Constructs a <c>MAPDisplacement</c> object using the provided <c>string</c> array as the data.
/// </summary>
/// <param name="lines">Data to parse</param>
/// <param name="lines">Data to parse.</param>
public MAPDisplacement(string[] lines) {
power = 0;
start = new Vector3(Single.NaN, Single.NaN, Single.NaN);
normals = null;
distances = null;
alphas = null;
Dictionary<int, string[]> normalsTokens = new Dictionary<int, string[]>(5);
Dictionary<int, string[]> distancesTokens = new Dictionary<int, string[]>(5);
Dictionary<int, string[]> alphasTokens = new Dictionary<int, string[]>(5);

View File

@@ -24,10 +24,15 @@ namespace LibBSP {
public Vector2 dims;
public string texture;
/// <summary>
/// Creates a new empty <c>MAPPatch</c> object. Internal data will have to be set manually.
/// </summary>
public MAPPatch() { }
/// <summary>
/// Constructs a new <c>MAPPatch</c> object using the supplied string array as data.
/// </summary>
/// <param name="lines">Data to parse</param>
/// <param name="lines">Data to parse.</param>
public MAPPatch(string[] lines) {
texture = lines[2];