Esempio n. 1
0
  private int[][] apply(boolean preview) {
    int[][] heightmap = new int[128][128];
    int step = 1;

    if (!preview) {
      parent.setProgressBar(sldIterations.getValue());
      heightmap = parent.cloneArray(parent.getHeightMap());
    } else {
      heightmap = parent.getPreviewMap();
      step =
          (int)
              Math.ceil(
                  (double) parent.getHeightMap().length / (double) parent.getPreviewMap().length);
    }

    for (int i = 0; i < sldIterations.getValue() / step; i++) {
      heightmap = applyThermal(heightmap);

      if (!preview) parent.increaseProgressBar();
    }

    if (!preview) parent.resetProgressBar();

    return heightmap;
  }