diff options
Diffstat (limited to 'src/classes/share')
-rw-r--r-- | src/classes/share/javax/media/j3d/BoundingBox.java | 49 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/BoundingSphere.java | 32 |
2 files changed, 17 insertions, 64 deletions
diff --git a/src/classes/share/javax/media/j3d/BoundingBox.java b/src/classes/share/javax/media/j3d/BoundingBox.java index 6a41dbd..c0a30b2 100644 --- a/src/classes/share/javax/media/j3d/BoundingBox.java +++ b/src/classes/share/javax/media/j3d/BoundingBox.java @@ -59,27 +59,6 @@ final Point3d upper; private Point3d centroid = null; private static final double EPS = 1.0E-8; - // reusable temp objects - private BoundingSphere tmpSphere = null; - private BoundingPolytope tmpPolytope = null; - - // Issue 561: Set by -Dj3d.releaseBoundingBoxMemory property. - // When set to true, the per-instance fields used in bounding box - // transformation are released at the end of transform methods. This saves - // a significant amount of memory in large scenes containing huge amounts - // of bounding boxes. Setting this false can improve performance when - // lots of transforms are performed. The default is false. - // This was initialing in MasterControl, but was moved to here to fix issue 592. This avoids - // instantiating and intializing VirtualUniverse and MasterControl - private static boolean releaseBoundingBoxMemory = false; - - static { - releaseBoundingBoxMemory = MasterControl.getBooleanProperty("j3d.releaseBoundingBoxMemory", - releaseBoundingBoxMemory, "releasing memory after bounding box transform"); - - } - - /** * Constructs and initializes a BoundingBox given min,max in x,y,z. * @param lower the "small" corner @@ -659,34 +638,18 @@ public void setUpper(Point3d p1) { this.transform(matrix); } else if(boundsObject.boundId == BOUNDING_SPHERE) { - if (tmpSphere == null) { - tmpSphere = new BoundingSphere( (BoundingSphere)boundsObject); - } else { - tmpSphere.set((BoundingSphere)boundsObject); - } - tmpSphere.transform(matrix); - this.set(tmpSphere); + BoundingSphere tmpSphere = new BoundingSphere(boundsObject); + tmpSphere.transform(matrix); + this.set(tmpSphere); } else if(boundsObject.boundId == BOUNDING_POLYTOPE) { - if (tmpPolytope == null) { - tmpPolytope = - new BoundingPolytope((BoundingPolytope) boundsObject); - } else { - tmpPolytope.set((BoundingPolytope)boundsObject); - } - tmpPolytope.transform(matrix); - this.set(tmpPolytope); - + BoundingPolytope tmpPolytope = new BoundingPolytope(boundsObject); + tmpPolytope.transform(matrix); + this.set(tmpPolytope); } else { throw new IllegalArgumentException(J3dI18N.getString("BoundingBox5")); } - - // Release the temporary fields: - if (releaseBoundingBoxMemory) { - tmpSphere = null; - tmpPolytope = null; - } } /** diff --git a/src/classes/share/javax/media/j3d/BoundingSphere.java b/src/classes/share/javax/media/j3d/BoundingSphere.java index 9e163f2..e7bec53 100644 --- a/src/classes/share/javax/media/j3d/BoundingSphere.java +++ b/src/classes/share/javax/media/j3d/BoundingSphere.java @@ -55,10 +55,6 @@ final Point3d center; */ double radius; - // reusable temp objects - private BoundingBox tmpBox = null; - private BoundingPolytope tmpPolytope = null; - /** * Constructs and initializes a BoundingSphere from a center and radius. * @param center the center of the bounding sphere @@ -767,25 +763,19 @@ public void setCenter(Point3d center) { return; } - if( boundsObject.boundId == BOUNDING_BOX){ - if (tmpBox == null) { - tmpBox = new BoundingBox( (BoundingBox)boundsObject); - } else { - tmpBox.set((BoundingBox)boundsObject); - } - tmpBox.transform(matrix); - this.set(tmpBox); - }else if( boundsObject.boundId == BOUNDING_SPHERE ) { + if (boundsObject.boundId == BOUNDING_BOX) { + BoundingBox tmpBox = new BoundingBox(boundsObject); + tmpBox.transform(matrix); + this.set(tmpBox); + } + else if (boundsObject.boundId == BOUNDING_SPHERE) { this.set(boundsObject); this.transform(matrix); - } else if(boundsObject.boundId == BOUNDING_POLYTOPE) { - if (tmpPolytope == null) { - tmpPolytope = new BoundingPolytope((BoundingPolytope)boundsObject); - } else { - tmpPolytope.set((BoundingPolytope)boundsObject); - } - tmpPolytope.transform(matrix); - this.set(tmpPolytope); + } + else if (boundsObject.boundId == BOUNDING_POLYTOPE) { + BoundingPolytope tmpPolytope = new BoundingPolytope(boundsObject); + tmpPolytope.transform(matrix); + this.set(tmpPolytope); } else { throw new IllegalArgumentException(J3dI18N.getString("BoundingSphere5")); } |