public void adjustHeight(Vector2f xz, float delta) { List<Vector2f> coord = new ArrayList<Vector2f>(); coord.add(xz); List<Float> h = new ArrayList<Float>(); h.add(delta); adjustHeight(coord, h); }
@Override public void adjustHeight(List<Vector2f> xz, List<Float> height) { Vector3f currentGridLocation = getCurrentCell().mult(getLocalScale()).multLocal(quadSize - 1); for (Vector2f vect : xz) { vect.x -= currentGridLocation.x; vect.y -= currentGridLocation.z; } super.adjustHeight(xz, height); }
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(); }
public void adjustHeight(Vector2f xz, float delta) { List<Vector2f> coord = new ArrayList<Vector2f>(); coord.add(xz); List<Float> h = new ArrayList<Float>(); h.add(delta); adjustHeight(coord, h); }
@Override public void adjustHeight(List<Vector2f> xz, List<Float> height) { Vector3f currentGridLocation = getCurrentCell().mult(getLocalScale()).multLocal(quadSize - 1); for (Vector2f vect : xz) { vect.x -= currentGridLocation.x; vect.y -= currentGridLocation.z; } super.adjustHeight(xz, height); }