From 464c325bf738716a77af113b250cb87b1dc8b5d0 Mon Sep 17 00:00:00 2001 From: paulby Date: Mon, 23 Apr 2007 18:44:29 +0000 Subject: Fix for issue 480. The bounds were being cached after being transformed, which is not what getBounds expects. git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@830 ba19aa83-45c5-6ac9-afd3-db810772062c --- .../javax/media/j3d/TransformGroupRetained.java | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/classes') diff --git a/src/classes/share/javax/media/j3d/TransformGroupRetained.java b/src/classes/share/javax/media/j3d/TransformGroupRetained.java index 3ef24af..518c84d 100644 --- a/src/classes/share/javax/media/j3d/TransformGroupRetained.java +++ b/src/classes/share/javax/media/j3d/TransformGroupRetained.java @@ -771,7 +771,14 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface void computeCombineBounds(Bounds bounds) { if (cachedBounds!=null && boundsAutoCompute) { - bounds.combine(cachedBounds); + 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; } @@ -784,7 +791,11 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface child = (NodeRetained)children.get(i); if(child != null) child.computeCombineBounds(boundingSphere); - } + } + + if (VirtualUniverse.mc.cacheAutoComputedBounds) { + cachedBounds = (Bounds) boundingSphere.clone(); + } } else { // Should this be lock too ? ( MT safe ? ) @@ -793,7 +804,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface } } - // Should this be lock too ? ( MT safe ? ) + // Should this be lock too ? ( MT safe ? ) // Thoughts : // Make a temp copy with lock : transform.getWithLock(trans);, but this will cause gc ... synchronized(transform) { @@ -801,9 +812,6 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface } bounds.combine(boundingSphere); - if (boundsAutoCompute && VirtualUniverse.mc.cacheAutoComputedBounds) { - cachedBounds = boundingSphere; - } } void processChildLocalToVworld(ArrayList dirtyTransformGroups, -- cgit v1.2.3