public static int doSubmeshesShareVertsOrTris(Mesh m, ref MB_Utility.MeshAnalysisResult mar) { MB_Utility.MB_Triangle mb_Triangle = new MB_Utility.MB_Triangle(); MB_Utility.MB_Triangle mb_Triangle2 = new MB_Utility.MB_Triangle(); int[][] array = new int[m.subMeshCount][]; for (int i = 0; i < m.subMeshCount; i++) { array[i] = m.GetTriangles(i); } bool flag = false; bool flag2 = false; for (int j = 0; j < m.subMeshCount; j++) { int[] array2 = array[j]; for (int k = j + 1; k < m.subMeshCount; k++) { int[] array3 = array[k]; for (int l = 0; l < array2.Length; l += 3) { mb_Triangle.Initialize(array2, l, j); for (int n = 0; n < array3.Length; n += 3) { mb_Triangle2.Initialize(array3, n, k); if (mb_Triangle.isSame(mb_Triangle2)) { flag2 = true; break; } if (mb_Triangle.sharesVerts(mb_Triangle2)) { flag = true; break; } } } } } if (flag2) { mar.hasOverlappingSubmeshVerts = true; mar.hasOverlappingSubmeshTris = true; return(2); } if (flag) { mar.hasOverlappingSubmeshVerts = true; mar.hasOverlappingSubmeshTris = false; return(1); } mar.hasOverlappingSubmeshTris = false; mar.hasOverlappingSubmeshVerts = false; return(0); }
public bool sharesVerts(MB_Utility.MB_Triangle obj) { return(((this.vs[0] == obj.vs[0] || this.vs[0] == obj.vs[1] || this.vs[0] == obj.vs[2]) && this.submeshIdx != obj.submeshIdx) || ((this.vs[1] == obj.vs[0] || this.vs[1] == obj.vs[1] || this.vs[1] == obj.vs[2]) && this.submeshIdx != obj.submeshIdx) || ((this.vs[2] == obj.vs[0] || this.vs[2] == obj.vs[1] || this.vs[2] == obj.vs[2]) && this.submeshIdx != obj.submeshIdx)); }
public bool isSame(object obj) { MB_Utility.MB_Triangle mb_Triangle = (MB_Utility.MB_Triangle)obj; return(this.vs[0] == mb_Triangle.vs[0] && this.vs[1] == mb_Triangle.vs[1] && this.vs[2] == mb_Triangle.vs[2] && this.submeshIdx != mb_Triangle.submeshIdx); }