OSDN Git Service

tweaks to getHeightmapHeight, removed old code
authorbrentowens <brentowens@75d07b2b-3a1a-0410-a2c5-0572b91ccdca>
Fri, 17 Jun 2011 15:56:52 +0000 (15:56 +0000)
committerbrentowens <brentowens@75d07b2b-3a1a-0410-a2c5-0572b91ccdca>
Fri, 17 Jun 2011 15:56:52 +0000 (15:56 +0000)
git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@7648 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java
engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java

index a5c4e57..5497928 100644 (file)
@@ -327,19 +327,6 @@ public class TerrainPatch extends Geometry {
         getMesh().setBuffer(Type.Position, 3, newVertexBuffer);\r
     }\r
 \r
-    public void adjustHeight(float x, float z, float delta) {\r
-        if (x < 0 || z < 0 || x >= size || z >= size)\r
-            return;\r
-        int idx = (int) (z * size + x);\r
-        float h = getMesh().getFloatBuffer(Type.Position).get(idx*3+1);\r
-        \r
-        geomap.getHeightData().put(idx, h+delta);\r
-\r
-        FloatBuffer newVertexBuffer = geomap.writeVertexArray(null, stepScale, false);\r
-        getMesh().clearBuffer(Type.Position);\r
-        getMesh().setBuffer(Type.Position, 3, newVertexBuffer);\r
-    }\r
-\r
     /**\r
      * recalculate all of this normal vectors in this terrain patch\r
      */\r
index e9e6eb6..fbdb408 100644 (file)
@@ -860,8 +860,9 @@ public class TerrainQuad extends Node implements Terrain {
 \r
     public float getHeightmapHeight(Vector2f xz) {\r
         // offset\r
-        int x = Math.round((xz.x / getLocalScale().x) + (float)totalSize / 2f);\r
-        int z = Math.round((xz.y / getLocalScale().z) + (float)totalSize / 2f);\r
+        int halfSize = totalSize / 2;\r
+        int x = Math.round((xz.x / getLocalScale().x) + halfSize);\r
+        int z = Math.round((xz.y / getLocalScale().z) + halfSize);\r
 \r
         return getHeightmapHeight(x, z);\r
     }\r