@Override public Node clone(boolean cloneMaterials) { BatchNode clone = (BatchNode) super.clone(cloneMaterials); if (batches.size() > 0) { for (Batch b : batches) { for (int i = 0; i < clone.children.size(); i++) { if (clone.children.get(i).getName().equals(b.geometry.getName())) { clone.children.remove(i); break; } } } clone.needsFullRebatch = true; clone.batches = new SafeArrayList<Batch>(Batch.class); clone.batchesByGeom = new HashMap<Geometry, Batch>(); clone.batch(); } return clone; }
@Override public Node clone(boolean cloneMaterials) { InstancedNode clone = (InstancedNode)super.clone(cloneMaterials); if (instancesMap.size() > 0) { // Remove all instanced geometries from the clone for (int i = 0; i < clone.children.size(); i++) { if (clone.children.get(i) instanceof InstancedGeometry) { clone.children.remove(i); } else if (clone.children.get(i) instanceof Geometry) { Geometry geom = (Geometry) clone.children.get(i); if (geom.isGrouped()) { throw new AssertionError(); } } } } // remove original control from the clone clone.controls.remove(this.control); // put clone's control in clone.control = new InstancedNodeControl(clone); clone.controls.add(clone.control); clone.lookUp = new InstanceTypeKey(); clone.igByGeom = new HashMap<Geometry, InstancedGeometry>(); clone.instancesMap = new HashMap<InstanceTypeKey, InstancedGeometry>(); clone.instance(); return clone; }
@Override public Node clone(boolean cloneMaterials) { BatchNode clone = (BatchNode) super.clone(cloneMaterials); if (batches.size() > 0) { for (Batch b : batches) { for (int i = 0; i < clone.children.size(); i++) { if (clone.children.get(i).getName().equals(b.geometry.getName())) { clone.children.remove(i); break; } } } clone.needsFullRebatch = true; clone.batches = new SafeArrayList<Batch>(Batch.class); clone.batchesByGeom = new HashMap<Geometry, Batch>(); clone.batch(); } return clone; }
@Override public Node clone(boolean cloneMaterials) { InstancedNode clone = (InstancedNode)super.clone(cloneMaterials); if (instancesMap.size() > 0) { // Remove all instanced geometries from the clone for (int i = 0; i < clone.children.size(); i++) { if (clone.children.get(i) instanceof InstancedGeometry) { clone.children.remove(i); } else if (clone.children.get(i) instanceof Geometry) { Geometry geom = (Geometry) clone.children.get(i); if (geom.isGrouped()) { throw new AssertionError(); } } } } // remove original control from the clone clone.controls.remove(this.control); // put clone's control in clone.control = new InstancedNodeControl(clone); clone.controls.add(clone.control); clone.lookUp = new InstanceTypeKey(); clone.igByGeom = new HashMap<Geometry, InstancedGeometry>(); clone.instancesMap = new HashMap<InstanceTypeKey, InstancedGeometry>(); clone.instance(); return clone; }