From 197bba7fe896a47b2ad92d89e35e37bb9b796d6d Mon Sep 17 00:00:00 2001 From: "nor..om" Date: Sun, 20 Nov 2011 12:09:21 +0000 Subject: [PATCH] - 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 --- .../com/jme3/bullet/util/CollisionShapeFactory.java | 4 ++-- .../com/jme3/bullet/util/CollisionShapeFactory.java | 4 ++-- .../terrain/com/jme3/terrain/geomipmap/TerrainPatch.java | 7 ++++++- .../terrain/com/jme3/terrain/geomipmap/TerrainQuad.java | 8 ++++---- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/engine/src/bullet/com/jme3/bullet/util/CollisionShapeFactory.java b/engine/src/bullet/com/jme3/bullet/util/CollisionShapeFactory.java index cc15bd508..b56a355bf 100644 --- a/engine/src/bullet/com/jme3/bullet/util/CollisionShapeFactory.java +++ b/engine/src/bullet/com/jme3/bullet/util/CollisionShapeFactory.java @@ -130,7 +130,7 @@ public class CollisionShapeFactory { } TerrainPatch terrain = (TerrainPatch) spatial; Transform trans = getTransform(spatial, realRootNode); - shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightmap(), terrain.getLocalScale()), + shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()), trans.getTranslation(), trans.getRotation().toRotationMatrix()); } @@ -175,7 +175,7 @@ public class CollisionShapeFactory { return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()); } else if (spatial instanceof TerrainPatch) { TerrainPatch terrain = (TerrainPatch) spatial; - return new HeightfieldCollisionShape(terrain.getHeightmap(), terrain.getLocalScale()); + return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()); } else if (spatial instanceof Geometry) { return createSingleMeshShape((Geometry) spatial, spatial); } else if (spatial instanceof Node) { diff --git a/engine/src/jbullet/com/jme3/bullet/util/CollisionShapeFactory.java b/engine/src/jbullet/com/jme3/bullet/util/CollisionShapeFactory.java index cc15bd508..b56a355bf 100644 --- a/engine/src/jbullet/com/jme3/bullet/util/CollisionShapeFactory.java +++ b/engine/src/jbullet/com/jme3/bullet/util/CollisionShapeFactory.java @@ -130,7 +130,7 @@ public class CollisionShapeFactory { } TerrainPatch terrain = (TerrainPatch) spatial; Transform trans = getTransform(spatial, realRootNode); - shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightmap(), terrain.getLocalScale()), + shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()), trans.getTranslation(), trans.getRotation().toRotationMatrix()); } @@ -175,7 +175,7 @@ public class CollisionShapeFactory { return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()); } else if (spatial instanceof TerrainPatch) { TerrainPatch terrain = (TerrainPatch) spatial; - return new HeightfieldCollisionShape(terrain.getHeightmap(), terrain.getLocalScale()); + return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()); } else if (spatial instanceof Geometry) { return createSingleMeshShape((Geometry) spatial, spatial); } else if (spatial instanceof Node) { diff --git a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java index 756532003..dfa7d9318 100644 --- a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java +++ b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java @@ -213,7 +213,12 @@ public class TerrainPatch extends Geometry { return lodEntropy; } - public float[] getHeightmap() { + @Deprecated + public FloatBuffer getHeightmap() { + return BufferUtils.createFloatBuffer(geomap.getHeightData()); + } + + public float[] getHeightMap() { return geomap.getHeightData(); } diff --git a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java index f94b6a064..8f03eaf3d 100644 --- a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java +++ b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java @@ -1796,13 +1796,13 @@ public class TerrainQuad extends Node implements Terrain { if (getChild(0) instanceof TerrainPatch) { for (Spatial s : getChildren()) { if ( ((TerrainPatch)s).getQuadrant() == 1) - ul = ((TerrainPatch)s).getHeightmap(); + ul = ((TerrainPatch)s).getHeightMap(); else if(((TerrainPatch) s).getQuadrant() == 2) - bl = ((TerrainPatch)s).getHeightmap(); + bl = ((TerrainPatch)s).getHeightMap(); else if(((TerrainPatch) s).getQuadrant() == 3) - ur = ((TerrainPatch)s).getHeightmap(); + ur = ((TerrainPatch)s).getHeightMap(); else if(((TerrainPatch) s).getQuadrant() == 4) - br = ((TerrainPatch)s).getHeightmap(); + br = ((TerrainPatch)s).getHeightMap(); } } else {