/** * Associate this <code>Geometry</code> with a {@link GeometryGroupNode}. * * Should only be called by the parent {@link GeometryGroupNode}. * * @param node Which {@link GeometryGroupNode} to associate with. * @param startIndex The starting index of this geometry in the group. */ public void associateWithGroupNode(GeometryGroupNode node, int startIndex) { if (isGrouped()) { unassociateFromGroupNode(); } this.groupNode = node; this.startIndex = startIndex; }
@Override protected void setParent(Node parent) { super.setParent(parent); // If the geometry is managed by group node we need to unassociate. if (parent == null && isGrouped()) { unassociateFromGroupNode(); } }
private void ungroupSceneGraph(Spatial s) { if (s instanceof Node) { for (Spatial sp : ((Node) s).getChildren()) { ungroupSceneGraph(sp); } } else if (s instanceof Geometry) { Geometry g = (Geometry) s; if (g.isGrouped()) { // Will invoke onGeometryUnassociated automatically. g.unassociateFromGroupNode(); if (InstancedNode.getGeometryStartIndex(g) != -1) { throw new AssertionError(); } } } }
/** * recursively visit the subgraph and unbatch geometries * * @param s */ private void unbatchSubGraph(Spatial s) { if (s instanceof Node) { for (Spatial sp : ((Node) s).getChildren()) { unbatchSubGraph(sp); } } else if (s instanceof Geometry) { Geometry g = (Geometry) s; if (g.isGrouped()) { g.unassociateFromGroupNode(); } } }
/** * Associate this <code>Geometry</code> with a {@link GeometryGroupNode}. * * Should only be called by the parent {@link GeometryGroupNode}. * * @param node Which {@link GeometryGroupNode} to associate with. * @param startIndex The starting index of this geometry in the group. */ public void associateWithGroupNode(GeometryGroupNode node, int startIndex) { if (isGrouped()) { unassociateFromGroupNode(); } this.groupNode = node; this.startIndex = startIndex; }
@Override protected void setParent(Node parent) { super.setParent(parent); // If the geometry is managed by group node we need to unassociate. if (parent == null && isGrouped()) { unassociateFromGroupNode(); } }
private void ungroupSceneGraph(Spatial s) { if (s instanceof Node) { for (Spatial sp : ((Node) s).getChildren()) { ungroupSceneGraph(sp); } } else if (s instanceof Geometry) { Geometry g = (Geometry) s; if (g.isGrouped()) { // Will invoke onGeometryUnassociated automatically. g.unassociateFromGroupNode(); if (InstancedNode.getGeometryStartIndex(g) != -1) { throw new AssertionError(); } } } }
/** * recursively visit the subgraph and unbatch geometries * * @param s */ private void unbatchSubGraph(Spatial s) { if (s instanceof Node) { for (Spatial sp : ((Node) s).getChildren()) { unbatchSubGraph(sp); } } else if (s instanceof Geometry) { Geometry g = (Geometry) s; if (g.isGrouped()) { g.unassociateFromGroupNode(); } } }