public boolean load() { // clean up data if needed. if (null != heightData) { unloadHeightMap(); } heightData = new float[size * size]; float[][] tempBuffer = new float[size][size]; Random random = new Random(seed); // Add the hills for (int i = 0; i < iterations; i++) { addHill(tempBuffer, random); } // transfer temporary buffer to final heightmap for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { setHeightAtPoint((float) tempBuffer[i][j], j, i); } } normalizeTerrain(NORMALIZE_RANGE); logger.fine("Created Heightmap using the Hill Algorithm"); return true; }
public boolean load() { // clean up data if needed. if (null != heightData) { unloadHeightMap(); } heightData = new float[size * size]; float[][] tempBuffer = new float[size][size]; Random random = new Random(seed); // Add the hills for (int i = 0; i < iterations; i++) { addHill(tempBuffer, random); } // transfer temporary buffer to final heightmap for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { setHeightAtPoint((float) tempBuffer[i][j], j, i); } } normalizeTerrain(NORMALIZE_RANGE); logger.fine("Created Heightmap using the Hill Algorithm"); return true; }