/** * Transform the input bound by the current LocalToVWorld, this one overwrite the one defined in * NodeRetained since for TransformGroup, it has to use currentChildLocalToVworld instead of * currentLocalToVworld */ void transformBounds(SceneGraphPath path, Bounds bound) { if (!((NodeRetained) path.item.retained).inSharedGroup) { bound.transform(getCurrentChildLocalToVworld()); } else { HashKey key = new HashKey(""); path.getHashKey(key); bound.transform(getCurrentChildLocalToVworld(key)); } }
void computeCombineBounds(Bounds bounds) { // Issue 514 : NPE in Wonderland : triggered in cached bounds computation if (validCachedBounds && boundsAutoCompute) { Bounds b = (Bounds) cachedBounds.clone(); // Should this be lock too ? ( MT safe ? ) // Thoughts : // Make a temp copy with lock : transform.getWithLock(trans);, but this will cause gc ... synchronized (transform) { b.transform(transform); } bounds.combine(b); return; } NodeRetained child; // issue 544 Bounds boundingObject = null; if (VirtualUniverse.mc.useBoxForGroupBounds) { boundingObject = new BoundingBox((Bounds) null); } else { boundingObject = new BoundingSphere(); ((BoundingSphere) boundingObject).setRadius(-1.0); } if (boundsAutoCompute) { for (int i = children.size() - 1; i >= 0; i--) { child = (NodeRetained) children.get(i); if (child != null) child.computeCombineBounds(boundingObject); } if (VirtualUniverse.mc.cacheAutoComputedBounds) { cachedBounds = (Bounds) boundingObject.clone(); } } else { // Should this be lock too ? ( MT safe ? ) synchronized (localBounds) { boundingObject.set(localBounds); } } // Should this be lock too ? ( MT safe ? ) // Thoughts : // Make a temp copy with lock : transform.getWithLock(trans);, but this will cause gc ... synchronized (transform) { boundingObject.transform(transform); } bounds.combine(boundingObject); }