public void randomizeHeightMap() { if(terrain != null) { try { HillHeightMap heightmap = new HillHeightMap(513, 2000, 25, 100, (long)((byte)100 * Math.random())); Material mat = terrain.getMaterial(); Vector3f scale = terrain.getLocalScale(); Vector3f trans = terrain.getLocalTranslation(); rootNode.detachChildNamed("Terrain"); terrain = new TerrainQuad("Terrain", 65, 513, heightmap.getHeightMap()); terrain.setLocalTranslation(trans); terrain.setLocalScale(scale); terrain.setMaterial(mat); terrain.setShadowMode(ShadowMode.Receive); rootNode.attachChild(terrain); } catch(Exception ex) { ex.printStackTrace(); } } }
heightmap = new HillHeightMap(tiles+1, iterations, minradius, maxradius, (byte) seed); terrain = new TerrainQuad("Terrain", 65, tiles+1, heightmap.getHeightMap());