using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using ProBuilder2.Common; using UnityEngine; // Token: 0x02000034 RID: 52 [AddComponentMenu("")] [DisallowMultipleComponent] [RequireComponent(typeof(MeshFilter))] [RequireComponent(typeof(MeshRenderer))] [RequireComponent(typeof(pb_Entity))] [ExecuteInEditMode] public class pb_Object : MonoBehaviour { // Token: 0x0600015B RID: 347 RVA: 0x000150F4 File Offset: 0x000134F4 private void Awake() { if (base.GetComponent().isPartOfStaticBatch) { return; } Vector3[] array = ((!(this.msh != null)) ? null : this.msh.normals); if (array == null || array.Length != this.msh.vertexCount || (array.Length > 0 && array[0] == Vector3.zero)) { if (this._vertices == null) { return; } this.ToMesh(); this.Refresh(RefreshMask.All); } } // Token: 0x0600015C RID: 348 RVA: 0x00015190 File Offset: 0x00013590 public static pb_Object InitWithObject(pb_Object pb) { Vector3[] array = new Vector3[pb.vertexCount]; Array.Copy(pb.vertices, array, pb.vertexCount); Vector2[] array2 = new Vector2[pb.vertexCount]; Array.Copy(pb.uv, array2, pb.vertexCount); Color[] array3 = new Color[pb.vertexCount]; Array.Copy(pb.colors, array3, pb.vertexCount); pb_Face[] array4 = new pb_Face[pb.faces.Length]; for (int i = 0; i < array4.Length; i++) { array4[i] = new pb_Face(pb.faces[i]); } pb_Object pb_Object = pb_Object.CreateInstanceWithElements(array, array2, array3, array4, pb.GetSharedIndices(), pb.GetSharedIndicesUV()); pb_Object.gameObject.name = pb.gameObject.name + "-clone"; return pb_Object; } // Token: 0x0600015D RID: 349 RVA: 0x0001526C File Offset: 0x0001366C public static pb_Object CreateInstanceWithPoints(Vector3[] vertices) { if (vertices.Length % 4 != 0) { global::UnityEngine.Debug.LogWarning("Invalid Geometry. Make sure vertices in are pairs of 4 (faces)."); return null; } GameObject gameObject = new GameObject(); pb_Object pb_Object = gameObject.AddComponent(); gameObject.name = "ProBuilder Mesh"; pb_Object.GeometryWithPoints(vertices); pb_Object.GetComponent().SetEntity(EntityType.Detail); return pb_Object; } // Token: 0x0600015E RID: 350 RVA: 0x000152BC File Offset: 0x000136BC public static pb_Object CreateInstanceWithVerticesFaces(Vector3[] v, pb_Face[] f) { GameObject gameObject = new GameObject(); pb_Object pb_Object = gameObject.AddComponent(); gameObject.name = "ProBuilder Mesh"; pb_Object.GeometryWithVerticesFaces(v, f); return pb_Object; } // Token: 0x0600015F RID: 351 RVA: 0x000152EC File Offset: 0x000136EC public static pb_Object CreateInstanceWithElements(Vector3[] v, Vector2[] u, Color[] c, pb_Face[] f, pb_IntArray[] si, pb_IntArray[] si_uv) { GameObject gameObject = new GameObject(); pb_Object pb_Object = gameObject.AddComponent(); pb_Object.SetVertices(v); pb_Object.SetUV(u); pb_Object.SetColors(c); pb_Object.SetSharedIndices(si ?? pb_IntArrayUtility.ExtractSharedIndices(v)); pb_Object.SetSharedIndicesUV(si_uv ?? new pb_IntArray[0]); pb_Object.SetFaces(f); pb_Object.ToMesh(); pb_Object.Refresh(RefreshMask.All); pb_Object.GetComponent().SetEntity(EntityType.Detail); return pb_Object; } // Token: 0x06000160 RID: 352 RVA: 0x0001536C File Offset: 0x0001376C public static pb_Object CreateInstanceWithElements(pb_Vertex[] vertices, pb_Face[] faces, pb_IntArray[] si, pb_IntArray[] si_uv) { GameObject gameObject = new GameObject(); pb_Object pb_Object = gameObject.AddComponent(); Vector3[] array; Color[] array2; Vector2[] array3; Vector3[] array4; Vector4[] array5; Vector2[] array6; List list; List list2; pb_Vertex.GetArrays(vertices, out array, out array2, out array3, out array4, out array5, out array6, out list, out list2); pb_Object.SetVertices(array); pb_Object.SetColors(array2); pb_Object.SetUV(array3); if (list != null) { pb_Object._uv3 = list; } if (list2 != null) { pb_Object._uv4 = list2; } pb_Object.SetSharedIndices(si ?? pb_IntArrayUtility.ExtractSharedIndices(array)); pb_Object.SetSharedIndicesUV(si_uv ?? new pb_IntArray[0]); pb_Object.SetFaces(faces); pb_Object.ToMesh(); pb_Object.Refresh(RefreshMask.All); pb_Object.GetComponent().SetEntity(EntityType.Detail); return pb_Object; } // Token: 0x17000019 RID: 25 // (get) Token: 0x06000161 RID: 353 RVA: 0x0001541D File Offset: 0x0001381D private pb_Face[] _faces { get { return this._quads; } } // Token: 0x14000001 RID: 1 // (add) Token: 0x06000162 RID: 354 RVA: 0x00015428 File Offset: 0x00013828 // (remove) Token: 0x06000163 RID: 355 RVA: 0x0001545C File Offset: 0x0001385C [field: DebuggerBrowsable(DebuggerBrowsableState.Never)] public static event Action onDestroyObject; // Token: 0x1700001A RID: 26 // (get) Token: 0x06000164 RID: 356 RVA: 0x00015490 File Offset: 0x00013890 // (set) Token: 0x06000165 RID: 357 RVA: 0x0001549D File Offset: 0x0001389D public Mesh msh { get { return base.GetComponent().sharedMesh; } set { base.gameObject.GetComponent().sharedMesh = value; } } // Token: 0x1700001B RID: 27 // (get) Token: 0x06000166 RID: 358 RVA: 0x000154B0 File Offset: 0x000138B0 public pb_Face[] faces { get { return this._quads; } } // Token: 0x1700001C RID: 28 // (get) Token: 0x06000167 RID: 359 RVA: 0x000154B8 File Offset: 0x000138B8 public pb_Face[] quads { get { global::UnityEngine.Debug.LogWarning("pb_Quad is deprecated. Please use pb_Face instead."); return this._quads; } } // Token: 0x1700001D RID: 29 // (get) Token: 0x06000168 RID: 360 RVA: 0x000154CA File Offset: 0x000138CA public pb_IntArray[] sharedIndices { get { return this._sharedIndices; } } // Token: 0x1700001E RID: 30 // (get) Token: 0x06000169 RID: 361 RVA: 0x000154D2 File Offset: 0x000138D2 public pb_IntArray[] sharedIndicesUV { get { return this._sharedIndicesUV; } } // Token: 0x1700001F RID: 31 // (get) Token: 0x0600016A RID: 362 RVA: 0x000154DA File Offset: 0x000138DA public int id { get { return base.gameObject.GetInstanceID(); } } // Token: 0x17000020 RID: 32 // (get) Token: 0x0600016B RID: 363 RVA: 0x000154E7 File Offset: 0x000138E7 public Vector3[] vertices { get { return this._vertices; } } // Token: 0x17000021 RID: 33 // (get) Token: 0x0600016C RID: 364 RVA: 0x000154EF File Offset: 0x000138EF public Color[] colors { get { return this._colors; } } // Token: 0x17000022 RID: 34 // (get) Token: 0x0600016D RID: 365 RVA: 0x000154F7 File Offset: 0x000138F7 public Vector2[] uv { get { return this._uv; } } // Token: 0x17000023 RID: 35 // (get) Token: 0x0600016E RID: 366 RVA: 0x000154FF File Offset: 0x000138FF public bool hasUv3 { get { return this._uv3 != null && this._uv3.Count == this.vertexCount; } } // Token: 0x17000024 RID: 36 // (get) Token: 0x0600016F RID: 367 RVA: 0x00015522 File Offset: 0x00013922 public bool hasUv4 { get { return this._uv4 != null && this._uv4.Count == this.vertexCount; } } // Token: 0x17000025 RID: 37 // (get) Token: 0x06000170 RID: 368 RVA: 0x00015545 File Offset: 0x00013945 public List uv3 { get { return this._uv3; } } // Token: 0x17000026 RID: 38 // (get) Token: 0x06000171 RID: 369 RVA: 0x0001554D File Offset: 0x0001394D public List uv4 { get { return this._uv4; } } // Token: 0x17000027 RID: 39 // (get) Token: 0x06000172 RID: 370 RVA: 0x00015555 File Offset: 0x00013955 public int faceCount { get { return (this._faces != null) ? this._faces.Length : 0; } } // Token: 0x17000028 RID: 40 // (get) Token: 0x06000173 RID: 371 RVA: 0x00015570 File Offset: 0x00013970 public int vertexCount { get { return (this._vertices != null) ? this._vertices.Length : 0; } } // Token: 0x17000029 RID: 41 // (get) Token: 0x06000174 RID: 372 RVA: 0x0001558B File Offset: 0x0001398B public int triangleCount { get { int num; if (this._faces == null) { num = 0; } else { num = this._faces.Sum((pb_Face x) => x.indices.Length); } return num; } } // Token: 0x06000175 RID: 373 RVA: 0x000155C8 File Offset: 0x000139C8 public pb_IntArray[] GetSharedIndices() { int num = this._sharedIndices.Length; pb_IntArray[] array = new pb_IntArray[num]; for (int i = 0; i < num; i++) { int[] array2 = new int[this._sharedIndices[i].Length]; Array.Copy(this._sharedIndices[i].array, array2, array2.Length); array[i] = new pb_IntArray(array2); } return array; } // Token: 0x06000176 RID: 374 RVA: 0x0001562C File Offset: 0x00013A2C public pb_IntArray[] GetSharedIndicesUV() { int num = this._sharedIndicesUV.Length; pb_IntArray[] array = new pb_IntArray[num]; for (int i = 0; i < num; i++) { int[] array2 = new int[this._sharedIndicesUV[i].Length]; Array.Copy(this._sharedIndicesUV[i].array, array2, array2.Length); array[i] = new pb_IntArray(array2); } return array; } // Token: 0x1700002A RID: 42 // (get) Token: 0x06000177 RID: 375 RVA: 0x0001568E File Offset: 0x00013A8E public pb_Face[] SelectedFaces { get { return this.faces.ValuesWithIndices(this.m_selectedFaces); } } // Token: 0x1700002B RID: 43 // (get) Token: 0x06000178 RID: 376 RVA: 0x000156A1 File Offset: 0x00013AA1 public int SelectedFaceCount { get { return this.m_selectedFaces.Length; } } // Token: 0x1700002C RID: 44 // (get) Token: 0x06000179 RID: 377 RVA: 0x000156AB File Offset: 0x00013AAB public int[] SelectedTriangles { get { return this.m_selectedTriangles; } } // Token: 0x1700002D RID: 45 // (get) Token: 0x0600017A RID: 378 RVA: 0x000156B3 File Offset: 0x00013AB3 public int SelectedTriangleCount { get { return this.m_selectedTriangles.Length; } } // Token: 0x1700002E RID: 46 // (get) Token: 0x0600017B RID: 379 RVA: 0x000156BD File Offset: 0x00013ABD public pb_Edge[] SelectedEdges { get { return this.m_SelectedEdges; } } // Token: 0x1700002F RID: 47 // (get) Token: 0x0600017C RID: 380 RVA: 0x000156C5 File Offset: 0x00013AC5 public int SelectedEdgeCount { get { return this.m_SelectedEdges.Length; } } // Token: 0x0600017D RID: 381 RVA: 0x000156D0 File Offset: 0x00013AD0 public void AddToFaceSelection(pb_Face face) { int num = Array.IndexOf(this.faces, face); if (num > -1) { this.SetSelectedFaces(this.m_selectedFaces.Add(num)); } } // Token: 0x0600017E RID: 382 RVA: 0x00015704 File Offset: 0x00013B04 public void SetSelectedFaces(IEnumerable selected) { List list = new List(); foreach (pb_Face pb_Face in selected) { int num = Array.IndexOf(this.faces, pb_Face); if (num > -1) { list.Add(num); } } this.SetSelectedFaces(list); } // Token: 0x0600017F RID: 383 RVA: 0x0001577C File Offset: 0x00013B7C public void SetSelectedFaces(IEnumerable selected) { this.m_selectedFaces = selected.ToArray(); this.m_selectedTriangles = pb_Face.AllTriangles(this.SelectedFaces); pb_Edge[] array = pb_Edge.AllEdges(this.SelectedFaces); int num = array.Length; this.m_SelectedEdges = new pb_Edge[num]; for (int i = 0; i < num; i++) { this.m_SelectedEdges[i] = new pb_Edge(array[i]); } } // Token: 0x06000180 RID: 384 RVA: 0x000157E4 File Offset: 0x00013BE4 public void SetSelectedEdges(IEnumerable edges) { this.m_selectedFaces = new int[0]; this.m_SelectedEdges = edges.Select((pb_Edge x) => new pb_Edge(x)).ToArray(); this.m_selectedTriangles = this.m_SelectedEdges.AllTriangles(); } // Token: 0x06000181 RID: 385 RVA: 0x0001583C File Offset: 0x00013C3C public void SetSelectedTriangles(int[] tris) { this.m_selectedFaces = new int[0]; this.m_SelectedEdges = new pb_Edge[0]; this.m_selectedTriangles = tris ?? new int[0]; } // Token: 0x06000182 RID: 386 RVA: 0x0001586A File Offset: 0x00013C6A public void RemoveFromFaceSelectionAtIndex(int index) { this.SetSelectedFaces(this.m_selectedFaces.RemoveAt(index)); } // Token: 0x06000183 RID: 387 RVA: 0x00015880 File Offset: 0x00013C80 public void RemoveFromFaceSelection(pb_Face face) { int num = Array.IndexOf(this.faces, face); if (num > -1) { this.SetSelectedFaces(this.m_selectedFaces.Remove(num)); } } // Token: 0x06000184 RID: 388 RVA: 0x000158B3 File Offset: 0x00013CB3 public void ClearSelection() { this.m_selectedFaces = new int[0]; this.m_SelectedEdges = new pb_Edge[0]; this.m_selectedTriangles = new int[0]; } // Token: 0x06000185 RID: 389 RVA: 0x000158D9 File Offset: 0x00013CD9 public void SetVertices(Vector3[] v) { this._vertices = v; } // Token: 0x06000186 RID: 390 RVA: 0x000158E4 File Offset: 0x00013CE4 public void SetVertices(IList vertices, bool applyMesh = false) { Vector3[] array; Color[] array2; Vector2[] array3; Vector3[] array4; Vector4[] array5; Vector2[] array6; List list; List list2; pb_Vertex.GetArrays(vertices, out array, out array2, out array3, out array4, out array5, out array6, out list, out list2); this.SetVertices(array); this.SetColors(array2); this.SetUV(array3); if (list != null) { this._uv3 = list; } if (list2 != null) { this._uv4 = list2; } if (applyMesh) { Mesh msh = this.msh; pb_Vertex pb_Vertex = vertices[0]; if (pb_Vertex.hasPosition) { msh.vertices = array; } if (pb_Vertex.hasColor) { msh.colors = array2; } if (pb_Vertex.hasUv0) { msh.uv = array3; } if (pb_Vertex.hasNormal) { msh.normals = array4; } if (pb_Vertex.hasTangent) { msh.tangents = array5; } if (pb_Vertex.hasUv2) { msh.uv2 = array6; } if (pb_Vertex.hasUv3 && list != null) { msh.SetUVs(2, list); } if (pb_Vertex.hasUv4 && list2 != null) { msh.SetUVs(3, list2); } } } // Token: 0x06000187 RID: 391 RVA: 0x00015A05 File Offset: 0x00013E05 public void SetUV(Vector2[] uvs) { this._uv = uvs; } // Token: 0x06000188 RID: 392 RVA: 0x00015A10 File Offset: 0x00013E10 public void SetFaces(pb_Face[] _qds) { this._quads = _qds.Where((pb_Face x) => x != null).ToArray(); if (this._quads.Length != _qds.Length) { global::UnityEngine.Debug.LogWarning("SetFaces() pruned " + (_qds.Length - this._quads.Length) + " null faces from this object."); } } // Token: 0x06000189 RID: 393 RVA: 0x00015A80 File Offset: 0x00013E80 public void SetSharedIndices(pb_IntArray[] si) { this._sharedIndices = si; } // Token: 0x0600018A RID: 394 RVA: 0x00015A89 File Offset: 0x00013E89 public void SetSharedIndices(IEnumerable> si) { this._sharedIndices = si.ToSharedIndices(); } // Token: 0x0600018B RID: 395 RVA: 0x00015A97 File Offset: 0x00013E97 public void SetSharedIndicesUV(pb_IntArray[] si) { this._sharedIndicesUV = si; } // Token: 0x0600018C RID: 396 RVA: 0x00015AA0 File Offset: 0x00013EA0 public void SetSharedIndicesUV(IEnumerable> si) { this._sharedIndicesUV = si.ToSharedIndices(); } // Token: 0x0600018D RID: 397 RVA: 0x00015AB0 File Offset: 0x00013EB0 private void GeometryWithPoints(Vector3[] v) { pb_Face[] array = new pb_Face[v.Length / 4]; for (int i = 0; i < v.Length; i += 4) { array[i / 4] = new pb_Face(new int[] { i, i + 1, i + 2, i + 1, i + 3, i + 2 }, pb_Constant.DefaultMaterial, new pb_UV(), 0, -1, -1, false); } this.SetVertices(v); this.SetUV(new Vector2[v.Length]); this.SetColors(pbUtil.FilledArray(Color.white, v.Length)); this.SetFaces(array); this.SetSharedIndices(pb_IntArrayUtility.ExtractSharedIndices(v)); this.ToMesh(); this.Refresh(RefreshMask.All); } // Token: 0x0600018E RID: 398 RVA: 0x00015B68 File Offset: 0x00013F68 public void GeometryWithVerticesFaces(Vector3[] v, pb_Face[] f) { this.SetVertices(v); this.SetUV(new Vector2[v.Length]); this.SetFaces(f); this.SetSharedIndices(pb_IntArrayUtility.ExtractSharedIndices(v)); this.ToMesh(); this.Refresh(RefreshMask.All); } // Token: 0x0600018F RID: 399 RVA: 0x00015BA4 File Offset: 0x00013FA4 private void GeometryWithVerticesFacesIndices(Vector3[] v, pb_Face[] f, pb_IntArray[] s) { this.SetFaces(f); this.SetVertices(v); this.SetUV(new Vector2[v.Length]); this.SetSharedIndices(s); if (this.msh != null) { global::UnityEngine.Object.DestroyImmediate(this.msh); } this.ToMesh(); this.Refresh(RefreshMask.All); } // Token: 0x06000190 RID: 400 RVA: 0x00015C04 File Offset: 0x00014004 public MeshRebuildReason Verify() { if (this.msh == null) { try { this.ToMesh(); this.Refresh(RefreshMask.All); } catch (Exception ex) { global::UnityEngine.Debug.LogError("Failed rebuilding null pb_Object. Cached mesh attributes are invalid or missing.\n" + ex.ToString()); } return MeshRebuildReason.Null; } int num; int.TryParse(this.msh.name.Replace("pb_Mesh", string.Empty), out num); if (num != this.id) { return MeshRebuildReason.InstanceIDMismatch; } return (this.msh.uv2 != null) ? MeshRebuildReason.None : MeshRebuildReason.Lightmap; } // Token: 0x06000191 RID: 401 RVA: 0x00015CAC File Offset: 0x000140AC public void ToMesh() { Mesh mesh = this.msh; if (mesh != null && mesh.vertexCount == this._vertices.Length) { mesh = this.msh; mesh.vertices = this._vertices; if (this._uv != null) { mesh.uv = this._uv; } } else { if (mesh == null) { mesh = new Mesh(); } else { mesh.Clear(); } mesh.vertices = this._vertices; } mesh.uv2 = null; int[][] array; Material[] array2; mesh.subMeshCount = pb_Face.MeshTriangles(this.faces, out array, out array2); for (int i = 0; i < array.Length; i++) { mesh.SetTriangles(array[i], i); } mesh.name = "pb_Mesh" + this.id; base.GetComponent().sharedMesh = mesh; base.GetComponent().sharedMaterials = array2; } // Token: 0x06000192 RID: 402 RVA: 0x00015DA4 File Offset: 0x000141A4 public void MakeUnique() { pb_Face[] array = new pb_Face[this._faces.Length]; for (int i = 0; i < array.Length; i++) { array[i] = new pb_Face(this._faces[i]); } pb_IntArray[] array2 = new pb_IntArray[this._sharedIndices.Length]; Array.Copy(this._sharedIndices, array2, array2.Length); this.SetSharedIndices(array2); this.SetFaces(array); Vector3[] array3 = new Vector3[this.vertexCount]; Array.Copy(this._vertices, array3, this.vertexCount); this.SetVertices(array3); if (this._uv != null && this._uv.Length == this.vertexCount) { Vector2[] array4 = new Vector2[this.vertexCount]; Array.Copy(this._uv, array4, this.vertexCount); this.SetUV(array4); } this.msh = new Mesh(); this.ToMesh(); this.Refresh(RefreshMask.All); } // Token: 0x06000193 RID: 403 RVA: 0x00015E98 File Offset: 0x00014298 public void Refresh(RefreshMask mask = RefreshMask.All) { if ((ushort)(mask & RefreshMask.UV) > 0) { this.RefreshUV(); } if ((ushort)(mask & RefreshMask.Colors) > 0) { this.RefreshColors(); } if ((ushort)(mask & RefreshMask.Normals) > 0) { this.RefreshNormals(); } if ((ushort)(mask & RefreshMask.Tangents) > 0) { this.RefreshTangents(); } if ((ushort)(mask & RefreshMask.Collisions) > 0) { this.RefreshCollisions(); } } // Token: 0x06000194 RID: 404 RVA: 0x00015EF8 File Offset: 0x000142F8 public void RefreshCollisions() { Mesh msh = this.msh; msh.RecalculateBounds(); if (!this.userCollisions && base.GetComponent()) { foreach (Collider collider in base.gameObject.GetComponents()) { Type type = collider.GetType(); if (type == typeof(BoxCollider)) { ((BoxCollider)collider).center = msh.bounds.center; ((BoxCollider)collider).size = msh.bounds.size; } else if (type == typeof(SphereCollider)) { ((SphereCollider)collider).center = msh.bounds.center; ((SphereCollider)collider).radius = pb_Math.LargestValue(msh.bounds.extents); } else if (type == typeof(CapsuleCollider)) { ((CapsuleCollider)collider).center = msh.bounds.center; Vector2 vector = new Vector2(msh.bounds.extents.x, msh.bounds.extents.z); ((CapsuleCollider)collider).radius = pb_Math.LargestValue(vector); ((CapsuleCollider)collider).height = msh.bounds.size.y; } else if (type == typeof(WheelCollider)) { ((WheelCollider)collider).center = msh.bounds.center; ((WheelCollider)collider).radius = pb_Math.LargestValue(msh.bounds.extents); } else if (type == typeof(MeshCollider)) { base.gameObject.GetComponent().sharedMesh = null; base.gameObject.GetComponent().sharedMesh = msh; } } } } // Token: 0x06000195 RID: 405 RVA: 0x00016110 File Offset: 0x00014510 public int GetUnusedTextureGroup(int i = 1) { while (Array.Exists(this.faces, (pb_Face element) => element.textureGroup == i)) { i++; } return i; } // Token: 0x06000196 RID: 406 RVA: 0x00016160 File Offset: 0x00014560 public int UnusedElementGroup(int i = 1) { while (Array.Exists(this.faces, (pb_Face element) => element.elementGroup == i)) { i++; } return i; } // Token: 0x06000197 RID: 407 RVA: 0x000161AF File Offset: 0x000145AF public void RefreshUV() { this.RefreshUV(this.faces); } // Token: 0x06000198 RID: 408 RVA: 0x000161C0 File Offset: 0x000145C0 public void GetUVs(int channel, List uvs) { uvs.Clear(); switch (channel) { default: { for (int i = 0; i < this.vertexCount; i++) { uvs.Add(this._uv[i]); } break; } case 1: if (this.msh != null && this.msh.uv2 != null) { Vector2[] uv = this.msh.uv2; for (int j = 0; j < uv.Length; j++) { uvs.Add(uv[j]); } } break; case 2: if (this._uv3 != null) { uvs.AddRange(this._uv3); } break; case 3: if (this._uv4 != null) { uvs.AddRange(this._uv4); } break; } } // Token: 0x06000199 RID: 409 RVA: 0x000162BC File Offset: 0x000146BC public void SetUVs(int channel, List uvs) { switch (channel) { case 1: this.msh.uv2 = uvs.Cast().ToArray(); return; case 2: this._uv3 = uvs; return; case 3: this._uv4 = uvs; return; } this._uv = uvs.Cast().ToArray(); } // Token: 0x0600019A RID: 410 RVA: 0x00016330 File Offset: 0x00014730 public void RefreshUV(IEnumerable facesToRefresh) { Vector2[] uv = this.msh.uv; Vector2[] array; if (this._uv != null && this._uv.Length == this.vertexCount) { array = this._uv; } else if (uv != null && uv.Length == this.vertexCount) { array = uv; } else { foreach (pb_Face pb_Face in this.faces) { pb_Face.manualUV = false; } facesToRefresh = this.faces; array = new Vector2[this.vertexCount]; } int num = -2; Dictionary> dictionary = new Dictionary>(); bool flag = false; foreach (pb_Face pb_Face2 in facesToRefresh) { if (pb_Face2.uv.useWorldSpace) { flag = true; } if (pb_Face2 != null && !pb_Face2.manualUV) { List list; if (pb_Face2.textureGroup > 0 && dictionary.TryGetValue(pb_Face2.textureGroup, out list)) { list.Add(pb_Face2); } else { Dictionary> dictionary2 = dictionary; int num2; if (pb_Face2.textureGroup > 0) { num2 = pb_Face2.textureGroup; } else { num = (num2 = num) - 1; } dictionary2.Add(num2, new List { pb_Face2 }); } } } if (this.faces.Length != facesToRefresh.Count()) { foreach (pb_Face pb_Face3 in this.faces) { if (!pb_Face3.manualUV) { if (dictionary.ContainsKey(pb_Face3.textureGroup) && !dictionary[pb_Face3.textureGroup].Contains(pb_Face3)) { dictionary[pb_Face3.textureGroup].Add(pb_Face3); } } } } num = 0; Vector3[] array2 = ((!flag) ? null : base.transform.ToWorldSpace(this.vertices)); foreach (KeyValuePair> keyValuePair in dictionary) { int[] array3 = pb_Face.AllTrianglesDistinct(keyValuePair.Value).ToArray(); Vector3 vector; if (keyValuePair.Value.Count > 1) { vector = pb_Projection.FindBestPlane(this._vertices, array3).normal; } else { vector = pb_Math.Normal(this, keyValuePair.Value[0]); } if (keyValuePair.Value[0].uv.useWorldSpace) { pb_UVUtility.PlanarMap2(array2, array, array3, keyValuePair.Value[0].uv, base.transform.TransformDirection(vector)); } else { pb_UVUtility.PlanarMap2(this.vertices, array, array3, keyValuePair.Value[0].uv, vector); } Vector2 localPivot = keyValuePair.Value[0].uv.localPivot; foreach (pb_Face pb_Face4 in keyValuePair.Value) { pb_Face4.uv.localPivot = localPivot; } } this._uv = array; this.msh.uv = array; } // Token: 0x0600019B RID: 411 RVA: 0x00016714 File Offset: 0x00014B14 public void SetFaceMaterial(pb_Face[] quad, Material mat) { for (int i = 0; i < quad.Length; i++) { quad[i].material = mat; } } // Token: 0x0600019C RID: 412 RVA: 0x0001673E File Offset: 0x00014B3E public void SetUV2(Vector2[] v) { base.GetComponent().sharedMesh.uv2 = v; } // Token: 0x0600019D RID: 413 RVA: 0x00016754 File Offset: 0x00014B54 public void RefreshColors() { Mesh sharedMesh = base.GetComponent().sharedMesh; if (this._colors == null || this._colors.Length != this.vertexCount) { this._colors = pbUtil.FilledArray(Color.white, this.vertexCount); } sharedMesh.colors = this._colors; } // Token: 0x0600019E RID: 414 RVA: 0x000167AD File Offset: 0x00014BAD public void SetColors(Color[] InColors) { this._colors = ((InColors.Length != this.vertexCount) ? pbUtil.FilledArray(Color.white, this.vertexCount) : InColors); } // Token: 0x0600019F RID: 415 RVA: 0x000167DC File Offset: 0x00014BDC public void SetFaceColor(pb_Face face, Color color) { if (this._colors == null) { this._colors = pbUtil.FilledArray(Color.white, this.vertexCount); } foreach (int num in face.distinctIndices) { this._colors[num] = color; } } // Token: 0x060001A0 RID: 416 RVA: 0x0001683B File Offset: 0x00014C3B public void SetTangents(Vector4[] tangents) { this._tangents = tangents; } // Token: 0x060001A1 RID: 417 RVA: 0x00016844 File Offset: 0x00014C44 public void RefreshNormals() { this.msh.RecalculateNormals(); Vector3[] normals = this.msh.normals; pb_MeshUtility.SmoothNormals(this, ref normals); base.GetComponent().sharedMesh.normals = normals; } // Token: 0x060001A2 RID: 418 RVA: 0x00016884 File Offset: 0x00014C84 public void RefreshTangents() { Mesh sharedMesh = base.GetComponent().sharedMesh; if (this._tangents != null && this._tangents.Length == this.vertexCount) { sharedMesh.tangents = this._tangents; } else { pb_MeshUtility.GenerateTangent(ref sharedMesh); } } // Token: 0x060001A3 RID: 419 RVA: 0x000168D4 File Offset: 0x00014CD4 public void OnDestroy() { if (!this.dontDestroyMeshOnDelete && Application.isEditor && !Application.isPlaying && Time.frameCount > 0) { if (pb_Object.onDestroyObject != null) { pb_Object.onDestroyObject(this); } else { global::UnityEngine.Object.DestroyImmediate(base.gameObject.GetComponent().sharedMesh, true); } } } // Token: 0x04000132 RID: 306 [SerializeField] private pb_Face[] _quads; // Token: 0x04000133 RID: 307 [SerializeField] private pb_IntArray[] _sharedIndices; // Token: 0x04000134 RID: 308 [SerializeField] private Vector3[] _vertices; // Token: 0x04000135 RID: 309 [SerializeField] private Vector2[] _uv; // Token: 0x04000136 RID: 310 [SerializeField] private List _uv3; // Token: 0x04000137 RID: 311 [SerializeField] private List _uv4; // Token: 0x04000138 RID: 312 [SerializeField] private Vector4[] _tangents; // Token: 0x04000139 RID: 313 [SerializeField] private pb_IntArray[] _sharedIndicesUV = new pb_IntArray[0]; // Token: 0x0400013A RID: 314 [SerializeField] private Color[] _colors; // Token: 0x0400013B RID: 315 public bool userCollisions; // Token: 0x0400013C RID: 316 public bool isSelectable = true; // Token: 0x0400013D RID: 317 public pb_UnwrapParameters unwrapParameters = new pb_UnwrapParameters(); // Token: 0x0400013E RID: 318 public string asset_guid; // Token: 0x04000140 RID: 320 public bool dontDestroyMeshOnDelete; // Token: 0x04000141 RID: 321 [SerializeField] private int[] m_selectedFaces = new int[0]; // Token: 0x04000142 RID: 322 [SerializeField] private pb_Edge[] m_SelectedEdges = new pb_Edge[0]; // Token: 0x04000143 RID: 323 [SerializeField] private int[] m_selectedTriangles = new int[0]; }