diff options
-rw-r--r-- | src/classes/share/javax/media/j3d/BoundingBox.java | 20 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/MasterControl.java | 11 |
2 files changed, 18 insertions, 13 deletions
diff --git a/src/classes/share/javax/media/j3d/BoundingBox.java b/src/classes/share/javax/media/j3d/BoundingBox.java index 1bb6dfa..0a8f3eb 100644 --- a/src/classes/share/javax/media/j3d/BoundingBox.java +++ b/src/classes/share/javax/media/j3d/BoundingBox.java @@ -63,6 +63,22 @@ public class BoundingBox extends Bounds { private BoundingPolytope tmpPolytope = null; private Point3d tmpP3d = 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. @@ -704,7 +720,7 @@ public class BoundingBox extends Bounds { } // Release the temporary fields: - if (VirtualUniverse.mc.releaseBoundingBoxMemory) { + if (releaseBoundingBoxMemory) { tmpSphere = null; tmpBox = null; tmpPolytope = null; @@ -800,7 +816,7 @@ public class BoundingBox extends Bounds { if ( tmpP3d.y < lower.y ) lower.y = tmpP3d.y; if ( tmpP3d.z < lower.z ) lower.z = tmpP3d.z; - if (VirtualUniverse.mc.releaseBoundingBoxMemory) { + if (releaseBoundingBoxMemory) { // Free memory tmpP3d = null; } diff --git a/src/classes/share/javax/media/j3d/MasterControl.java b/src/classes/share/javax/media/j3d/MasterControl.java index 3e44138..c8c5e1e 100644 --- a/src/classes/share/javax/media/j3d/MasterControl.java +++ b/src/classes/share/javax/media/j3d/MasterControl.java @@ -496,14 +496,6 @@ class MasterControl { //Default false value does affect Java3D View dispose behavior. boolean forceReleaseView = false; - // 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. - boolean releaseBoundingBoxMemory = false; - // Issue 480: Cache the bounds of nodes so that getBounds does not // recompute the boounds of the entire graph per call boolean cacheAutoComputedBounds = false; @@ -562,9 +554,6 @@ class MasterControl { "forceReleaseView after Canvas3D dispose enabled", "forceReleaseView after Canvas3D dispose disabled"); - releaseBoundingBoxMemory = getBooleanProperty("j3d.releaseBoundingBoxMemory", - releaseBoundingBoxMemory, "releasing memory after bounding box transform"); - useCombiners = getBooleanProperty("j3d.usecombiners", useCombiners, "Using NV_register_combiners if available", "NV_register_combiners disabled"); |