using System; using System.Collections.Generic; using ProBuilder2.Common; using UnityEngine; namespace ProBuilder2.MeshOperations { // Token: 0x02000011 RID: 17 public static class pb_GrowShrink { // Token: 0x06000096 RID: 150 RVA: 0x0000C8EC File Offset: 0x0000ACEC public static HashSet GrowSelection(pb_Object pb, IList faces, float maxAngleDiff = -1f) { List wingedEdges = pb_WingedEdge.GetWingedEdges(pb, true); HashSet hashSet = new HashSet(faces); HashSet hashSet2 = new HashSet(); Vector3 vector = Vector3.zero; bool flag = maxAngleDiff > 0f; for (int i = 0; i < wingedEdges.Count; i++) { if (hashSet.Contains(wingedEdges[i].face)) { if (flag) { vector = pb_Math.Normal(pb, wingedEdges[i].face); } pb_WingedEdgeEnumerator enumerator = wingedEdges[i].GetEnumerator(); try { while (enumerator.MoveNext()) { pb_WingedEdge pb_WingedEdge = enumerator.Current; if (pb_WingedEdge.opposite != null && !hashSet.Contains(pb_WingedEdge.opposite.face)) { if (flag) { Vector3 vector2 = pb_Math.Normal(pb, pb_WingedEdge.opposite.face); if (Vector3.Angle(vector, vector2) < maxAngleDiff) { hashSet2.Add(pb_WingedEdge.opposite.face); } } else { hashSet2.Add(pb_WingedEdge.opposite.face); } } } } finally { IDisposable disposable; if ((disposable = enumerator as IDisposable) != null) { disposable.Dispose(); } } } } return hashSet2; } // Token: 0x06000097 RID: 151 RVA: 0x0000CA40 File Offset: 0x0000AE40 public static void Flood(pb_WingedEdge wing, HashSet selection) { pb_GrowShrink.Flood(null, wing, pb_GrowShrink.Vector3_Zero, -1f, selection); } // Token: 0x06000098 RID: 152 RVA: 0x0000CA54 File Offset: 0x0000AE54 public static void Flood(pb_Object pb, pb_WingedEdge wing, Vector3 wingNrm, float maxAngle, HashSet selection) { pb_WingedEdge pb_WingedEdge = wing; do { pb_WingedEdge opposite = pb_WingedEdge.opposite; if (opposite != null && !selection.Contains(opposite.face)) { if (maxAngle > 0f) { Vector3 vector = pb_Math.Normal(pb, opposite.face); if (Vector3.Angle(wingNrm, vector) < maxAngle && selection.Add(opposite.face)) { pb_GrowShrink.Flood(pb, opposite, vector, maxAngle, selection); } } else if (selection.Add(opposite.face)) { pb_GrowShrink.Flood(pb, opposite, wingNrm, maxAngle, selection); } } pb_WingedEdge = pb_WingedEdge.next; } while (pb_WingedEdge != wing); } // Token: 0x06000099 RID: 153 RVA: 0x0000CAF4 File Offset: 0x0000AEF4 public static HashSet FloodSelection(pb_Object pb, IList faces, float maxAngleDiff) { List wingedEdges = pb_WingedEdge.GetWingedEdges(pb, true); HashSet hashSet = new HashSet(faces); HashSet hashSet2 = new HashSet(); for (int i = 0; i < wingedEdges.Count; i++) { if (!hashSet2.Contains(wingedEdges[i].face) && hashSet.Contains(wingedEdges[i].face)) { hashSet2.Add(wingedEdges[i].face); pb_GrowShrink.Flood(pb, wingedEdges[i], (maxAngleDiff <= 0f) ? pb_GrowShrink.Vector3_Zero : pb_Math.Normal(pb, wingedEdges[i].face), maxAngleDiff, hashSet2); } } return hashSet2; } // Token: 0x0400002E RID: 46 private static readonly Vector3 Vector3_Zero = new Vector3(0f, 0f, 0f); } }