@Override void setCompiled() { super.setCompiled(); if (sharedGroup != null) { sharedGroup.setCompiled(); } }
@Override void removeNodeData(SetLiveState s) { if (refCount <= 0) { // either not in sharedGroup or last instance in sharedGroup // remove this node from parentTransformLink's childTransformLink if (parentTransformLink != null) { ArrayList<NodeRetained> obj; if (parentTransformLink instanceof TransformGroupRetained) { obj = ((TransformGroupRetained) parentTransformLink).childTransformLinks; } else { obj = ((SharedGroupRetained) parentTransformLink).childTransformLinks; } synchronized (obj) { obj.remove(this); } } // remove this node from parentSwitchLink's childSwitchLink if (parentSwitchLink != null) { for (int i = 0; i < parentSwitchLink.childrenSwitchLinks.size(); i++) { ArrayList<NodeRetained> switchLinks = parentSwitchLink.childrenSwitchLinks.get(i); if (switchLinks.contains(this)) { switchLinks.remove(this); break; } } } } super.removeNodeData(s); }
@Override void setBoundsAutoCompute(boolean autoCompute) { super.setBoundsAutoCompute(autoCompute); if (!autoCompute) { localBounds = getBounds(); } }
@Override void setNodeData(SetLiveState s) { super.setNodeData(s); // add this node to parentTransformLink's childTransformLink if (s.childTransformLinks != null) { // do not duplicate shared nodes synchronized (s.childTransformLinks) { if (!inSharedGroup || !s.childTransformLinks.contains(this)) { s.childTransformLinks.add(this); } } } // add this node to parentSwitchLink's childSwitchLink if (s.childSwitchLinks != null) { if (!inSharedGroup || // only add if not already added in sharedGroup !s.childSwitchLinks.contains(this)) { s.childSwitchLinks.add(this); } } }
/** assign a name to this node when it is made live. */ @Override void clearLive(SetLiveState s) { if (sharedGroup != null) { HashKey newKeys[] = getNewKeys(s.locale.nodeId, s.keys); super.clearLive(s); HashKey oldKeys[] = s.keys; s.keys = newKeys; s.inSharedGroup = true; this.sharedGroup.parents.remove(this); this.sharedGroup.clearLive(s); s.inSharedGroup = inSharedGroup; s.keys = oldKeys; } else { super.clearLive(s); } }
@Override void updateCollidable(HashKey keys[], boolean collide[]) { super.updateCollidable(keys, collide); if (sharedGroup != null) { HashKey newKeys[] = getNewKeys(locale.nodeId, keys); sharedGroup.updateCollidable(newKeys, collide); } }
@Override void updatePickable(HashKey keys[], boolean pick[]) { super.updatePickable(keys, pick); if (sharedGroup != null) { HashKey newKeys[] = getNewKeys(locale.nodeId, keys); sharedGroup.updatePickable(newKeys, pick); } }
/** assign a name to this node when it is made live. */ @Override void setLive(SetLiveState s) { super.doSetLive(s); if (inBackgroundGroup) { throw new IllegalSceneGraphException(J3dI18N.getString("LinkRetained0")); } if (nodeId == null) { nodeId = universe.getNodeId(); } if (sharedGroup != null) { this.sharedGroup.parents.add(this); HashKey newKeys[] = getNewKeys(s.locale.nodeId, s.keys); HashKey oldKeys[] = s.keys; s.keys = newKeys; s.inSharedGroup = true; if (visited) { throw new SceneGraphCycleException(J3dI18N.getString("LinkRetained1")); } visited = true; try { this.sharedGroup.setLive(s); } catch (SceneGraphCycleException e) { throw e; } finally { visited = false; } s.inSharedGroup = inSharedGroup; s.keys = oldKeys; localBounds.setWithLock(this.sharedGroup.localBounds); } super.markAsLive(); }
@Override void compile(CompileState compState) { super.compile(compState); // XXXX: for now keep the static transform in the parent tg compState.keepTG = true; // don't remove this group node mergeFlag = SceneGraphObjectRetained.DONT_MERGE; if (J3dDebug.devPhase && J3dDebug.debug) { compState.numLinks++; } }