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); }
@Override void computeCombineBounds(Bounds bounds) { if (boundsAutoCompute) { sharedGroup.computeCombineBounds(bounds); } else { // Should this be lock too ? ( MT safe ? ) synchronized (localBounds) { bounds.combine(localBounds); } } }