Update to latest Gaea, allow configuration of terrain octaves/frequency

This commit is contained in:
dfsek
2020-10-17 16:49:43 -07:00
parent 2c49160731
commit 2741a761a0
32 changed files with 136 additions and 111 deletions

View File

@@ -54,9 +54,9 @@ public class ImageLoader {
float[] noise;
if(align.equals(Align.CENTER)) noise = tb.getGrid(x - original.getWidth()/2, y - original.getHeight()/2).getRawNoise(x - original.getWidth()/2, y - original.getHeight()/2);
else noise = tb.getGrid(x, y).getRawNoise(x, y);
newImg.setRGB(x, y, new Color((int) (NormalizationUtil.normalize(noise[0], tb.getGrid(x, y).getSizeX()) * ((double) 255 / tb.getGrid(x, y).getSizeX())),
(int) (NormalizationUtil.normalize(noise[1], tb.getGrid(x, y).getSizeZ()) * ((double) 255 / tb.getGrid(x, y).getSizeZ())),
(int) (NormalizationUtil.normalize(z.getNoise(x, y), z.getSize()) * ((double) 255 / z.getSize())))
newImg.setRGB(x, y, new Color((int) (NormalizationUtil.normalize(noise[0], tb.getGrid(x, y).getSizeX(), 4) * ((double) 255 / tb.getGrid(x, y).getSizeX())),
(int) (NormalizationUtil.normalize(noise[1], tb.getGrid(x, y).getSizeZ(), 4) * ((double) 255 / tb.getGrid(x, y).getSizeZ())),
(int) (NormalizationUtil.normalize(z.getNoise(x, y), z.getSize(), 4) * ((double) 255 / z.getSize())))
.getRGB());
}
}

View File

@@ -27,9 +27,9 @@ public class WorldImageGenerator {
for(int y = centerZ - (draw.getHeight()/2); y < centerZ + (draw.getHeight()/2); y++) {
int imX = 0;
for(int x = centerX - (draw.getWidth()/2); x < centerX + (draw.getWidth()/2); x++) {
int zone = NormalizationUtil.normalize(tw.getZone().getRawNoise(x, y), 256);
int zone = NormalizationUtil.normalize(tw.getZone().getRawNoise(x, y), 256, 4);
float[] noise = tb.getGrid(x, y).getRawNoise(x, y);
Color c = new Color(NormalizationUtil.normalize(noise[0], 256), NormalizationUtil.normalize(noise[1], 256), zone);
Color c = new Color(NormalizationUtil.normalize(noise[0], 256, 4), NormalizationUtil.normalize(noise[1], 256, 4), zone);
draw.setRGB(imX, imY, c.getRGB());
imX++;
}