using System.Collections.Generic; using System.Linq; using UnityEngine; namespace SplineMesh { public class MeshUtility { public static int[] GetReversedTriangles(Mesh mesh) { int[] array = mesh.triangles.ToArray(); int num = array.Length / 3; for (int i = 0; i < num; i++) { int num2 = array[i * 3]; array[i * 3] = array[i * 3 + 1]; array[i * 3 + 1] = num2; } return array; } public static void Update(Mesh mesh, Mesh source, IEnumerable triangles = null, IEnumerable vertices = null, IEnumerable normals = null, IEnumerable uv = null, IEnumerable uv2 = null, IEnumerable uv3 = null, IEnumerable uv4 = null, IEnumerable uv5 = null, IEnumerable uv6 = null, IEnumerable uv7 = null, IEnumerable uv8 = null) { mesh.hideFlags = source.hideFlags; mesh.indexFormat = source.indexFormat; mesh.triangles = new int[0]; mesh.vertices = ((vertices == null) ? source.vertices : vertices.ToArray()); mesh.normals = ((normals == null) ? source.normals : normals.ToArray()); mesh.uv = ((uv == null) ? source.uv : uv.ToArray()); mesh.uv2 = ((uv2 == null) ? source.uv2 : uv2.ToArray()); mesh.uv3 = ((uv3 == null) ? source.uv3 : uv3.ToArray()); mesh.uv4 = ((uv4 == null) ? source.uv4 : uv4.ToArray()); mesh.uv5 = ((uv5 == null) ? source.uv5 : uv5.ToArray()); mesh.uv6 = ((uv6 == null) ? source.uv6 : uv6.ToArray()); mesh.uv7 = ((uv7 == null) ? source.uv7 : uv7.ToArray()); mesh.uv8 = ((uv8 == null) ? source.uv8 : uv8.ToArray()); mesh.triangles = ((triangles == null) ? source.triangles : triangles.ToArray()); mesh.RecalculateBounds(); mesh.RecalculateTangents(); } } }