- fix TerrainPatch method signature to not break old projects, deprecate getHeightmap, add new getHeightMap

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8737 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
nor..om 2011-11-20 12:09:21 +00:00
parent aa4b8d19e7
commit 197bba7fe8
4 changed files with 14 additions and 9 deletions

View File

@ -130,7 +130,7 @@ public class CollisionShapeFactory {
} }
TerrainPatch terrain = (TerrainPatch) spatial; TerrainPatch terrain = (TerrainPatch) spatial;
Transform trans = getTransform(spatial, realRootNode); Transform trans = getTransform(spatial, realRootNode);
shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightmap(), terrain.getLocalScale()), shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()),
trans.getTranslation(), trans.getTranslation(),
trans.getRotation().toRotationMatrix()); trans.getRotation().toRotationMatrix());
} }
@ -175,7 +175,7 @@ public class CollisionShapeFactory {
return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()); return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale());
} else if (spatial instanceof TerrainPatch) { } else if (spatial instanceof TerrainPatch) {
TerrainPatch terrain = (TerrainPatch) spatial; TerrainPatch terrain = (TerrainPatch) spatial;
return new HeightfieldCollisionShape(terrain.getHeightmap(), terrain.getLocalScale()); return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale());
} else if (spatial instanceof Geometry) { } else if (spatial instanceof Geometry) {
return createSingleMeshShape((Geometry) spatial, spatial); return createSingleMeshShape((Geometry) spatial, spatial);
} else if (spatial instanceof Node) { } else if (spatial instanceof Node) {

View File

@ -130,7 +130,7 @@ public class CollisionShapeFactory {
} }
TerrainPatch terrain = (TerrainPatch) spatial; TerrainPatch terrain = (TerrainPatch) spatial;
Transform trans = getTransform(spatial, realRootNode); Transform trans = getTransform(spatial, realRootNode);
shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightmap(), terrain.getLocalScale()), shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()),
trans.getTranslation(), trans.getTranslation(),
trans.getRotation().toRotationMatrix()); trans.getRotation().toRotationMatrix());
} }
@ -175,7 +175,7 @@ public class CollisionShapeFactory {
return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()); return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale());
} else if (spatial instanceof TerrainPatch) { } else if (spatial instanceof TerrainPatch) {
TerrainPatch terrain = (TerrainPatch) spatial; TerrainPatch terrain = (TerrainPatch) spatial;
return new HeightfieldCollisionShape(terrain.getHeightmap(), terrain.getLocalScale()); return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale());
} else if (spatial instanceof Geometry) { } else if (spatial instanceof Geometry) {
return createSingleMeshShape((Geometry) spatial, spatial); return createSingleMeshShape((Geometry) spatial, spatial);
} else if (spatial instanceof Node) { } else if (spatial instanceof Node) {

View File

@ -213,7 +213,12 @@ public class TerrainPatch extends Geometry {
return lodEntropy; return lodEntropy;
} }
public float[] getHeightmap() { @Deprecated
public FloatBuffer getHeightmap() {
return BufferUtils.createFloatBuffer(geomap.getHeightData());
}
public float[] getHeightMap() {
return geomap.getHeightData(); return geomap.getHeightData();
} }

View File

@ -1796,13 +1796,13 @@ public class TerrainQuad extends Node implements Terrain {
if (getChild(0) instanceof TerrainPatch) { if (getChild(0) instanceof TerrainPatch) {
for (Spatial s : getChildren()) { for (Spatial s : getChildren()) {
if ( ((TerrainPatch)s).getQuadrant() == 1) if ( ((TerrainPatch)s).getQuadrant() == 1)
ul = ((TerrainPatch)s).getHeightmap(); ul = ((TerrainPatch)s).getHeightMap();
else if(((TerrainPatch) s).getQuadrant() == 2) else if(((TerrainPatch) s).getQuadrant() == 2)
bl = ((TerrainPatch)s).getHeightmap(); bl = ((TerrainPatch)s).getHeightMap();
else if(((TerrainPatch) s).getQuadrant() == 3) else if(((TerrainPatch) s).getQuadrant() == 3)
ur = ((TerrainPatch)s).getHeightmap(); ur = ((TerrainPatch)s).getHeightMap();
else if(((TerrainPatch) s).getQuadrant() == 4) else if(((TerrainPatch) s).getQuadrant() == 4)
br = ((TerrainPatch)s).getHeightmap(); br = ((TerrainPatch)s).getHeightMap();
} }
} }
else { else {