using System; using System.Collections.Generic; using System.Linq; using ProBuilder2.Common; namespace ProBuilder2.MeshOperations { // Token: 0x0200000E RID: 14 public static class pb_DeleteVertices { // Token: 0x0600008C RID: 140 RVA: 0x0000B864 File Offset: 0x00009C64 public static int[] RemoveUnusedVertices(this pb_Object pb) { List list = new List(); HashSet hashSet = new HashSet(pb_Face.AllTriangles(pb.faces)); for (int i = 0; i < pb.vertices.Length; i++) { if (!hashSet.Contains(i)) { list.Add(i); } } pb.DeleteVerticesWithIndices(list); return list.ToArray(); } // Token: 0x0600008D RID: 141 RVA: 0x0000B8C4 File Offset: 0x00009CC4 public static void DeleteVerticesWithIndices(this pb_Object pb, IEnumerable distInd) { if (distInd == null || distInd.Count() < 1) { return; } pb_Vertex[] array = pb_Vertex.GetVertices(pb, null); int num = array.Length; int[] offset = new int[num]; List sorted = new List(distInd); sorted.Sort(); array = array.SortedRemoveAt(sorted); for (int i = 0; i < num; i++) { offset[i] = pbUtil.NearestIndexPriorToValue(sorted, i) + 1; } foreach (pb_Face pb_Face in pb.faces) { int[] indices = pb_Face.indices; for (int k = 0; k < indices.Length; k++) { indices[k] -= offset[indices[k]]; } pb_Face.RebuildCaches(); } IEnumerable> enumerable = from x in pb.sharedIndices.ToDictionary() where sorted.BinarySearch(x.Key) < 0 select x into y select new KeyValuePair(y.Key - offset[y.Key], y.Value); IEnumerable> enumerable2 = from x in pb.sharedIndicesUV.ToDictionary() where sorted.BinarySearch(x.Key) < 0 select x into y select new KeyValuePair(y.Key - offset[y.Key], y.Value); pb.SetVertices(array, false); pb.SetSharedIndices(enumerable); pb.SetSharedIndicesUV(enumerable2); pb.ToMesh(); } } }