/** * @return the parent of this node, or null if this node has no parent * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public Node getParent() { if (isLiveOrCompiled()) { if(!this.getCapability(ALLOW_PARENT_READ)) { throw new CapabilityNotSetException(J3dI18N.getString("Node0")); } } NodeRetained nr = ((NodeRetained)this.retained).getParent(); return (nr == null ? null : (Node) nr.getSource()); }
/** * Evaluate the view platform transform by traversing *up* the tree from * this ViewPlatform node, computing the composite model transform * along the way. Because we are traversing bottom to top, we must * multiply each TransformGroup's matrix on the left by the * composite transform on the right (rather than the other way * around as is usually done). Once we have the composite model * transform for this ViewPlatform--the vpcToVworld transform--we * simply invert it to get the vworldToVpc transform. */ void evaluateInitViewPlatformTransform(NodeRetained node, Transform3D trans) { if (node instanceof TransformGroupRetained) { Transform3D tmpTrans = new Transform3D(); TransformGroupRetained tgr = (TransformGroupRetained)node; tgr.transform.getWithLock(tmpTrans); trans.mul(tmpTrans, trans); } NodeRetained parent = node.getParent(); if (parent != null) { // Not at the top yet. evaluateInitViewPlatformTransform(parent, trans); } }
NodeRetained nodeParentR = nodeR.getParent();
/** * Compute the LocalToVworld of this node even though it is not live. We * assume the graph is attached at the origin of a locale */ void computeNonLiveLocalToVworld(Transform3D t, Node caller) { NodeRetained n = getParent(); if (n==null) t.setIdentity(); else n.computeNonLiveLocalToVworld(t, caller); if (this instanceof TransformGroupRetained && this.source!=caller) { Transform3D trans = new Transform3D(); ((TransformGroupRetained)this).getTransform(trans); t.mul(trans); } }