[committed] Geometry patch for storing vboInfo

Is there any reason for not storing vboInfo?

I suggest this.



Index: src/com/jme/scene/Geometry.java
===================================================================
--- src/com/jme/scene/Geometry.java   (revision 4080)
+++ src/com/jme/scene/Geometry.java   (working copy)
@@ -864,6 +864,7 @@
         capsule.write(castsShadows, "castsShadows", true);
         capsule.write(bound, "bound", null);
         capsule.write(defaultColor, "defaultColor", ColorRGBA.white);
+        capsule.write(vboInfo, "vboInfo", null);
     }
 
     @SuppressWarnings("unchecked")
@@ -889,6 +890,7 @@
             worldBound = bound.clone(null);
         defaultColor = (ColorRGBA) capsule.readSavable("defaultColor",
                 ColorRGBA.white.clone());
+        vboInfo = (VBOInfo) capsule.readSavable("vboInfo", null);
     }
 
     /**

For geometry having multiple texture coordinates, the patch above throws an exception.

ResizeTextureIds() call is needed.



Index: src/com/jme/scene/VBOInfo.java
===================================================================
--- src/com/jme/scene/VBOInfo.java   (revision 4080)
+++ src/com/jme/scene/VBOInfo.java   (working copy)
@@ -268,6 +268,9 @@
    }
 
    public void setVBOTextureID(int index, int id) {
+      if (index >= vboTextureIDs.length) {
+         resizeTextureIds(index+1);
+      }
       vboTextureIDs[index] = id;
    }
 
Index: src/com/jme/scene/Geometry.java
===================================================================
--- src/com/jme/scene/Geometry.java   (revision 4080)
+++ src/com/jme/scene/Geometry.java   (working copy)
@@ -864,6 +864,7 @@
         capsule.write(castsShadows, "castsShadows", true);
         capsule.write(bound, "bound", null);
         capsule.write(defaultColor, "defaultColor", ColorRGBA.white);
+        capsule.write(vboInfo, "vboInfo", null);
     }
 
     @SuppressWarnings("unchecked")
@@ -889,6 +890,7 @@
             worldBound = bound.clone(null);
         defaultColor = (ColorRGBA) capsule.readSavable("defaultColor",
                 ColorRGBA.white.clone());
+        vboInfo = (VBOInfo) capsule.readSavable("vboInfo", null);
     }
 
     /**

Can you explain what is gained by storing VBO info, or what is lost by not? For my own education.

My intension is so simple.

I think that it would be handy to save and restore vbo status in jme format.

If not, we have to set vbo every time model is loaded.

If there is any problem or reason not to do this, please let me know.


No problem. I'm not really familiar with VBO data.