[commited] NODE: updateWorldBound(recursive)

The standard tool for updating a node's worldBound is using updateGeometricState(0,true).

Problem with this is that all controllers are called (with time 0) and if you don't catch that

your controllers might be called too often. For that I added a possibility for nodes to update

the whole subtree's worldboundings before. (Of course you have to use updateWolrdVectors(true) before and propagateBoundToRoot() after inorder to have the same effect as the updategeometricstate(…) )



Now you can update the worldboundings inside the controller without being forced to use the GameTaskManager as well.





This is the patch:


### Eclipse Workspace Patch 1.0
#P jme2
Index: src/com/jme/scene/Node.java
===================================================================
--- src/com/jme/scene/Node.java   (revision 4766)
+++ src/com/jme/scene/Node.java   (working copy)
@@ -560,7 +560,12 @@
      * @see com.jme.scene.Spatial#updateWorldBound()
      */
     @Override
-    public void updateWorldBound() {
+    public void updateWorldBound()
+    {
+       updateWorldBound(false);
+    }
+
+    public void updateWorldBound(boolean recursive) {
         if ((lockedMode & Spatial.LOCKED_BOUNDS) != 0) return;
         if (children == null) {
             return;
@@ -569,6 +574,13 @@
         for (int i = 0, cSize = children.size(); i < cSize; i++) {
             Spatial child =  children.get(i);
             if (child != null) {
+               // first update the whole subtree
+               if (recursive)
+                  if (child instanceof Node)
+                     ((Node)child).updateWorldBound(true);
+                  else
+                     child.updateWorldBound();
+               
                 if (worldBound != null) {
                     // merge current world bound with child world bound
                     worldBound.mergeLocal(child.getWorldBound());