Browse Source

tweaks to getHeightmapHeight, removed old code

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7648 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
bre..ns 14 years ago
parent
commit
4148e216b4

+ 0 - 13
engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java

@@ -327,19 +327,6 @@ public class TerrainPatch extends Geometry {
         getMesh().setBuffer(Type.Position, 3, newVertexBuffer);
     }
 
-    public void adjustHeight(float x, float z, float delta) {
-        if (x < 0 || z < 0 || x >= size || z >= size)
-            return;
-        int idx = (int) (z * size + x);
-        float h = getMesh().getFloatBuffer(Type.Position).get(idx*3+1);
-        
-        geomap.getHeightData().put(idx, h+delta);
-
-        FloatBuffer newVertexBuffer = geomap.writeVertexArray(null, stepScale, false);
-        getMesh().clearBuffer(Type.Position);
-        getMesh().setBuffer(Type.Position, 3, newVertexBuffer);
-    }
-
     /**
      * recalculate all of this normal vectors in this terrain patch
      */

+ 3 - 2
engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java

@@ -860,8 +860,9 @@ public class TerrainQuad extends Node implements Terrain {
 
     public float getHeightmapHeight(Vector2f xz) {
         // offset
-        int x = Math.round((xz.x / getLocalScale().x) + (float)totalSize / 2f);
-        int z = Math.round((xz.y / getLocalScale().z) + (float)totalSize / 2f);
+        int halfSize = totalSize / 2;
+        int x = Math.round((xz.x / getLocalScale().x) + halfSize);
+        int z = Math.round((xz.y / getLocalScale().z) + halfSize);
 
         return getHeightmapHeight(x, z);
     }