mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
triangulation properties wrapped as read-only
This commit is contained in:
parent
5a0ef82fec
commit
496619d211
6 changed files with 23 additions and 22 deletions
|
@ -313,7 +313,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
renderer.PlotVerticesSet(General.Map.Map.Vertices);
|
||||
|
||||
// Go for all triangle vertices
|
||||
for(int i = 0; i < t.Vertices.Length; i += 3)
|
||||
for(int i = 0; i < t.Vertices.Count; i += 3)
|
||||
{
|
||||
renderer.PlotLine(t.Vertices[i + 0], t.Vertices[i + 1], General.Colors.Selection);
|
||||
renderer.PlotLine(t.Vertices[i + 1], t.Vertices[i + 2], General.Colors.Selection);
|
||||
|
|
|
@ -64,8 +64,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
base.Texture = General.Map.Data.GetFlatImage(s.LongCeilTexture);
|
||||
|
||||
// Make vertices
|
||||
verts = new WorldVertex[s.Triangles.Vertices.Length];
|
||||
for(int i = 0; i < s.Triangles.Vertices.Length; i++)
|
||||
verts = new WorldVertex[s.Triangles.Vertices.Count];
|
||||
for(int i = 0; i < s.Triangles.Vertices.Count; i++)
|
||||
{
|
||||
// Use sector brightness for color shading
|
||||
PixelColor pc = new PixelColor(255, unchecked((byte)s.Brightness), unchecked((byte)s.Brightness), unchecked((byte)s.Brightness));
|
||||
|
|
|
@ -63,8 +63,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
base.Texture = General.Map.Data.GetFlatImage(s.LongFloorTexture);
|
||||
|
||||
// Make vertices
|
||||
verts = new WorldVertex[s.Triangles.Vertices.Length];
|
||||
for(int i = 0; i < s.Triangles.Vertices.Length; i++)
|
||||
verts = new WorldVertex[s.Triangles.Vertices.Count];
|
||||
for(int i = 0; i < s.Triangles.Vertices.Count; i++)
|
||||
{
|
||||
// Use sector brightness for color shading
|
||||
PixelColor pc = new PixelColor(255, unchecked((byte)s.Brightness), unchecked((byte)s.Brightness), unchecked((byte)s.Brightness));
|
||||
|
|
|
@ -631,7 +631,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
if(triangles != null)
|
||||
{
|
||||
// Go for all islands
|
||||
for(int island = 0; island < triangles.IslandVertices.Length; island++)
|
||||
for(int island = 0; island < triangles.IslandVertices.Count; island++)
|
||||
{
|
||||
Dictionary<Sidedef, Linedef> sides = new Dictionary<Sidedef, Linedef>(triangles.IslandVertices[island] >> 1);
|
||||
List<Line2D> candidatelines = new List<Line2D>(triangles.IslandVertices[island] >> 1);
|
||||
|
@ -641,7 +641,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
// Make candidate lines that are not along sidedefs
|
||||
// We do this before testing the candidate against the sidedefs so that
|
||||
// we can collect the relevant sidedefs first in the same run
|
||||
for(int i = 0; i < triangles.Vertices.Length; i += 3)
|
||||
for(int i = 0; i < triangles.Vertices.Count; i += 3)
|
||||
{
|
||||
Vector2D v1 = triangles.Vertices[i + 2];
|
||||
for(int k = 0; k < 3; k++)
|
||||
|
|
|
@ -26,6 +26,7 @@ using CodeImp.DoomBuilder.Rendering;
|
|||
using SlimDX.Direct3D9;
|
||||
using System.Drawing;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -62,23 +63,23 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
#region ================== Variables
|
||||
|
||||
// Number of vertices per island
|
||||
private int[] islandvertices;
|
||||
private ReadOnlyCollection<int> islandvertices;
|
||||
|
||||
// Vertices that result from the triangulation, 3 per triangle.
|
||||
private Vector2D[] vertices;
|
||||
private ReadOnlyCollection<Vector2D> vertices;
|
||||
|
||||
// These sidedefs match with the vertices. If a vertex is not the start
|
||||
// along a sidedef, this list contains a null entry for that vertex.
|
||||
private Sidedef[] sidedefs;
|
||||
private ReadOnlyCollection<Sidedef> sidedefs;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
public int[] IslandVertices { get { return islandvertices; } }
|
||||
public Vector2D[] Vertices { get { return vertices; } }
|
||||
public Sidedef[] Sidedefs { get { return sidedefs; } }
|
||||
|
||||
|
||||
public ReadOnlyCollection<int> IslandVertices { get { return islandvertices; } }
|
||||
public ReadOnlyCollection<Vector2D> Vertices { get { return vertices; } }
|
||||
public ReadOnlyCollection<Sidedef> Sidedefs { get { return sidedefs; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
@ -127,9 +128,9 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
islandslist.Add(DoEarClip(p, verticeslist, sidedefslist));
|
||||
|
||||
// Make arrays
|
||||
islandvertices = islandslist.ToArray();
|
||||
vertices = verticeslist.ToArray();
|
||||
sidedefs = sidedefslist.ToArray();
|
||||
islandvertices = Array.AsReadOnly<int>(islandslist.ToArray());
|
||||
vertices = Array.AsReadOnly<Vector2D>(verticeslist.ToArray());
|
||||
sidedefs = Array.AsReadOnly<Sidedef>(sidedefslist.ToArray());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -595,7 +596,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
t = GetTriangle(v);
|
||||
|
||||
// Add ear as triangle
|
||||
AddTriangleToList(t, verticeslist, sidedefslist, (verts.Count > 3));
|
||||
AddTriangleToList(t, verticeslist, sidedefslist, (verts.Count == 3));
|
||||
countvertices += 3;
|
||||
|
||||
// Remove this ear from all lists
|
||||
|
@ -694,7 +695,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
verticeslist.Add(triangle[1].Position);
|
||||
sidedefslist.Add(triangle[1].Sidedef);
|
||||
verticeslist.Add(triangle[2].Position);
|
||||
if(last) sidedefslist.Add(null); else sidedefslist.Add(triangle[2].Sidedef);
|
||||
if(!last) sidedefslist.Add(null); else sidedefslist.Add(triangle[2].Sidedef);
|
||||
|
||||
// Modify the first earclipvertex of this triangle, it no longer lies along a sidedef
|
||||
triangle[0].Sidedef = null;
|
||||
|
|
|
@ -229,8 +229,8 @@ namespace CodeImp.DoomBuilder.Map
|
|||
int brightint = brightcolor.ToInt();
|
||||
|
||||
// Make vertices
|
||||
flatvertices = new FlatVertex[triangles.Vertices.Length];
|
||||
for(int i = 0; i < triangles.Vertices.Length; i++)
|
||||
flatvertices = new FlatVertex[triangles.Vertices.Count];
|
||||
for(int i = 0; i < triangles.Vertices.Count; i++)
|
||||
{
|
||||
flatvertices[i].x = triangles.Vertices[i].x;
|
||||
flatvertices[i].y = triangles.Vertices[i].y;
|
||||
|
|
Loading…
Reference in a new issue