reduced terrain save j3o file size

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7883 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
bre..ns 14 years ago
parent a2b83be8bd
commit c54ce7be27
  1. 2
      engine/nbproject/project.properties
  2. 11
      engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java
  3. 6
      engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java

@ -86,7 +86,7 @@ platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
run.jvmargs=-Xms30m -Xmx30m -XX:MaxDirectMemorySize=256M
run.jvmargs=-Xms128m -Xmx128m -XX:MaxDirectMemorySize=256M
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}

@ -1036,6 +1036,11 @@ public class TerrainPatch extends Geometry {
@Override
public void write(JmeExporter ex) throws IOException {
// the mesh is removed, and reloaded when read() is called
// this reduces the save size to 10% by not saving the mesh
Mesh temp = getMesh();
mesh = null;
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(size, "size", 16);
@ -1048,6 +1053,8 @@ public class TerrainPatch extends Geometry {
oc.write(lodCalculatorFactory, "lodCalculatorFactory", null);
oc.write(lodEntropy, "lodEntropy", null);
oc.write(geomap, "geomap", null);
setMesh(temp);
}
@Override
@ -1065,6 +1072,10 @@ public class TerrainPatch extends Geometry {
lodCalculatorFactory = (LodCalculatorFactory) ic.readSavable("lodCalculatorFactory", null);
lodEntropy = ic.readFloatArray("lodEntropy", null);
geomap = (LODGeomap) ic.readSavable("geomap", null);
Mesh regen = geomap.createMesh(stepScale, new Vector2f(1,1), offset, offsetAmount, totalSize, false);
setMesh(regen);
TangentBinormalGenerator.generate(this); // note that this will be removed
}
@Override

@ -1520,6 +1520,12 @@ public class TerrainQuad extends Node implements Terrain {
quadrant = c.readInt("quadrant", 0);
totalSize = c.readInt("totalSize", 0);
lodCalculatorFactory = (LodCalculatorFactory) c.readSavable("lodCalculatorFactory", null);
if ( !(getParent() instanceof TerrainQuad) ) {
BoundingBox all = new BoundingBox(getWorldTranslation(), totalSize, totalSize, totalSize);
affectedAreaBBox = all;
updateNormals();
}
}
@Override

Loading…
Cancel
Save