public int[] GetVertUIDs() { if (nochange) { return(prev.GetVertUIDs()); } return(vertuids); }
public static IndexedViewableAlpha MeshIntersect(SnapshotModel model0, SnapshotModel model1, Vec3f[] match, bool applymods) { int nverts = model0.nverts; Vec3f[] verts = null; int[] vertuids = null; bool[] vsel = null; int[][] visiblegroups = null; Vec4f[][] colors = { new Vec4f[nverts], new Vec4f[nverts], new Vec4f[nverts], new Vec4f[nverts] }; float[] pointsizes = (model0.objedit ? pointsizes_edit : pointsizes_view).DeepCopy(); float[] linewidths = (model0.objedit ? linewidths_edit : (model0.objselected ? linewidths_selected : linewidths_unselected)).DeepCopy(); IndexedViewableAlpha viewable = null; for (int i = 0; i < nverts; i++) { if (!model0.objvisible) { colors[0][i] = colorobjhidden; colors[1][i] = colorobjhidden; colors[2][i] = colorobjhidden; colors[3][i] = colorobjhidden; } else if (model0.objedit) { colors[0][i] = colorvertunselected; //( isvertselected[i] ? colorvertselected : colorvertunselected ); colors[1][i] = colorvertunselected; //( isvertselected[i] ? colorvertselected : colorvertunselected ); colors[2][i] = colorface; colors[3][i] = colorface; } else if (model0.objselected) { if (model0.objactive) { colors[0][i] = colorobjactive; colors[1][i] = colorobjactive; colors[2][i] = colorface; colors[3][i] = colorface; } else { colors[0][i] = colorobjselected; colors[1][i] = colorobjselected; colors[2][i] = colorface; colors[3][i] = colorface; } } else { colors[0][i] = colorobjunselected; colors[1][i] = colorobjunselected; colors[2][i] = colorface; colors[3][i] = colorface; } } List <GroupInfo>[] groups0 = model0.GetGroups(); List <GroupInfo>[] groups1 = model1.GetGroups(); List <int>[] lstvisiblegroups = new List <int>[] { new List <int>(groups0[0].Count), new List <int>(groups0[1].Count * 2), new List <int>(groups0[2].Count * 3), new List <int>(groups0[3].Count * 4) }; int[] uids0 = model0.GetVertUIDs(); int[] uids1 = model1.GetVertUIDs(); for (int igroups = 0; igroups < 4; igroups++) { List <int> lstcurrent = lstvisiblegroups[igroups]; int i0 = 0; int i1 = 0; List <GroupInfo> grps0 = groups0[igroups]; List <GroupInfo> grps1 = groups1[igroups]; int c0 = grps0.Count; int c1 = grps1.Count; while (i0 < c0 && i1 < c1) { GroupInfo g0 = grps0[i0]; GroupInfo g1 = grps1[i1]; string k0 = g0.GetKeyNoVis(uids0); string k1 = g1.GetKeyNoVis(uids1); int comp = k0.CompareTo(k1); if (comp == 1) { i1++; continue; } if (comp == -1) { i0++; continue; } lstcurrent.AddRange(g0.inds); i0++; i1++; } } visiblegroups = new int[][] { lstvisiblegroups[0].ToArray(), lstvisiblegroups[1].ToArray(), lstvisiblegroups[2].ToArray(), lstvisiblegroups[3].ToArray() }; verts = model0.GetVerts().CloneArray(); vertuids = model0.GetVertUIDs().CloneArray(); if (model0.objedit) { vsel = model0.isvertselected.CloneArray(); } else { vsel = new bool[nverts]; } viewable = new IndexedViewableAlpha(verts, colors, visiblegroups, pointsizes, linewidths, groupsizes.CloneArray(), vertuids, vsel); if (match != null) { viewable = history.MakeVertsConsistent(viewable, match); } if (applymods) { foreach (Modifier m in model0.modifiers) { if (m is ModifierMirror) { ModifierMirror mirror = (ModifierMirror)m; viewable += viewable.CreateMirrorData_Each(mirror.usex, mirror.usey, mirror.usez, mirror.mergethreshold); } } } return(viewable); }