private void adjustHeight(Vector3f loc, float radius, float height) { // offset it by radius because in the loop we iterate through 2 radii int radiusStepsX = (int) (radius / terrain.getLocalScale().x); int radiusStepsZ = (int) (radius / terrain.getLocalScale().z); float xStepAmount = terrain.getLocalScale().x; float zStepAmount = terrain.getLocalScale().z; long start = System.currentTimeMillis(); List<Vector2f> locs = new ArrayList<Vector2f>(); List<Float> heights = new ArrayList<Float>(); for (int z = -radiusStepsZ; z < radiusStepsZ; z++) { for (int x = -radiusStepsX; x < radiusStepsX; x++) { float locX = loc.x + (x * xStepAmount); float locZ = loc.z + (z * zStepAmount); if (isInRadius(locX - loc.x, locZ - loc.z, radius)) { // see if it is in the radius of the tool float h = calculateHeight(radius, height, locX - loc.x, locZ - loc.z); locs.add(new Vector2f(locX, locZ)); heights.add(h); } } } terrain.adjustHeight(locs, heights); // System.out.println("Modified "+locs.size()+" points, took: " + (System.currentTimeMillis() - // start)+" ms"); terrain.updateModelBound(); }