/// <summary> /// Finalize arrays for vertices and polygons /// by linking to cached versions /// </summary> public void FinalizePVArrays() { for (var i = 0; i < VertexArray.Vertices.Count; i++) { VertexArray.Vertices[i] = VertexCache.Get(VertexArray.Vertices[i]); } for (var i = 0; i < Polygons.Count; i++) { Polygons[i] = PolygonCache.Get(Polygons[i]); } }
/// <summary> /// Constructs a polygon from the DAT file /// </summary> public Polygon(DatLoader.Entity.Polygon polygon, DatLoader.Entity.CVertexArray vertexArray) { NegSurface = polygon.NegSurface; //NegUVIndices = polygon.NegUVIndices; PosSurface = polygon.PosSurface; //PosUVIndices = polygon.PosUVIndices; SidesType = polygon.SidesType; Stippling = polygon.Stippling; VertexIDs = polygon.VertexIds; Vertices = new List <Vertex>(); foreach (var vertexIdx in VertexIDs) { Vertices.Add(VertexCache.Get(vertexArray.Vertices[(ushort)vertexIdx])); } make_plane(); }