/** * Copies all Fog information from <code>originalNode</code> into the current node. This method is * called from the <code>cloneNode</code> method which is, in turn, called by the <code>cloneTree * </code> method. * * <p> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the <code>duplicateOnCloneTree * </code> flag to be ignored. When <code>false</code>, the value of each node's <code> * duplicateOnCloneTree</code> variable determines whether NodeComponent data is duplicated or * copied. * @exception RestrictedAccessException if this object is part of a live or compiled scenegraph. * @see Node#duplicateNode * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ @Override void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); FogRetained attr = (FogRetained) originalNode.retained; FogRetained rt = (FogRetained) retained; Color3f c = new Color3f(); attr.getColor(c); rt.initColor(c); rt.initInfluencingBounds(attr.getInfluencingBounds()); Enumeration<Group> elm = attr.getAllScopes(); while (elm.hasMoreElements()) { // this reference will set correctly in updateNodeReferences() callback rt.initAddScope(elm.nextElement()); } // this reference will set correctly in updateNodeReferences() callback rt.initInfluencingBoundingLeaf(attr.getInfluencingBoundingLeaf()); }
/** * Callback used to allow a node to check if any nodes referenced by that node have been * duplicated via a call to <code>cloneTree</code>. This method is called by <code>cloneTree * </code> after all nodes in the sub-graph have been duplicated. The cloned Leaf node's method * will be called and the Leaf node can then look up any node references by using the <code> * getNewObjectReference</code> method found in the <code>NodeReferenceTable</code> object. If a * match is found, a reference to the corresponding Node in the newly cloned sub-graph is * returned. If no corresponding reference is found, either a DanglingReferenceException is thrown * or a reference to the original node is returned depending on the value of the <code> * allowDanglingReferences</code> parameter passed in the <code>cloneTree</code> call. * * <p>NOTE: Applications should <i>not</i> call this method directly. It should only be called by * the cloneTree method. * * @param referenceTable a NodeReferenceTableObject that contains the <code>getNewObjectReference * </code> method needed to search for new object instances. * @see NodeReferenceTable * @see Node#cloneTree * @see DanglingReferenceException */ @Override public void updateNodeReferences(NodeReferenceTable referenceTable) { FogRetained rt = (FogRetained) retained; BoundingLeaf bl = rt.getInfluencingBoundingLeaf(); if (bl != null) { Object o = referenceTable.getNewObjectReference(bl); rt.initInfluencingBoundingLeaf((BoundingLeaf) o); } int num = rt.numScopes(); for (int i = 0; i < num; i++) { rt.initScope((Group) referenceTable.getNewObjectReference(rt.getScope(i)), i); } }