public PolyMesh Clone() { PolyMesh cp = new PolyMesh(); cp.verts = (Vertex[])verts.Clone(); cp.poly = new Poly[poly.Length]; for (int i = 0; i < poly.Length; i++) { cp.poly[i] = poly[i].Clone(); } return cp; }
public void MoveGeometry(PolyMesh dst) { // offset the vertex indices and move polygons for (int a = 0; a < poly.Length; a++) { Poly pl = poly[a]; for (int b = 0; b < pl.Length; b++) pl[b] += dst.verts.Length; } List<Poly> dstPoly = new List<Poly>(dst.poly); dstPoly.AddRange(poly); dst.poly = dstPoly.ToArray(); poly = null; // insert the child vertices List<Vertex> dstVerts = new List<Vertex>(dst.verts); dstVerts.AddRange(verts); dst.verts = dstVerts.ToArray(); verts = null; // InvalidateRenderData(); }
public PolyMesh GetOrCreatePolyMesh() { if (polyMesh == null) polyMesh = new PolyMesh(); return polyMesh; }