Rather large refactor:

Most changes were just small adjustments for coding style.
Made "using" statements for Unity, rather than non-Unity compiles. So in Unity "Vector3d" is an alias for "Vector3", instead of the other way around.
Restrict CountAttribute and IndexAttribute to apply to properties and fields only.
Removed Rect and RectExtensions, Rect was never used anywhere and was leftover from a long-gone part of this project.
Remove unnecessary "this" references and refactor Int32, Single, etc. to int, float, etc. (I might have missed a few of these).
Refactor MAPBrushSide to use a TextureInfo rather than duplicating many fields.
Make Terrain and Displacement formats use two-dimensional arrays rather than arrays of arrays.
Rename UIVertex to Vertex.
This commit is contained in:
wfowler
2018-08-25 17:43:28 -06:00
parent 1014184f24
commit 5becc7dac4
49 changed files with 626 additions and 946 deletions

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
namespace LibBSP {
/// <summary>
/// Holds all the data for an edge in a BSP map.
/// </summary>
@@ -96,9 +97,10 @@ namespace LibBSP {
throw new ArgumentException("Map type " + type + " isn't supported by the Edge lump factory.");
}
}
List<Edge> lump = new List<Edge>(data.Length / structLength);
int numObjects = data.Length / structLength;
List<Edge> lump = new List<Edge>(numObjects);
byte[] bytes = new byte[structLength];
for (int i = 0; i < data.Length / structLength; ++i) {
for (int i = 0; i < numObjects; ++i) {
Array.Copy(data, (i * structLength), bytes, 0, structLength);
lump.Add(new Edge(bytes, type, version));
}
@@ -138,5 +140,6 @@ namespace LibBSP {
}
}
}
}
}