Cache 2D noise results to increase performance, update to latest Gaea

This commit is contained in:
dfsek
2020-10-31 15:46:09 -07:00
parent 89bc05fde8
commit be70ffa1b4
21 changed files with 51 additions and 26 deletions

View File

@@ -56,7 +56,7 @@ public class ImageLoader {
BiomeZone z = TerraWorld.getWorld(w).getZone();
for(int x = 0; x < newImg.getWidth(); x++) {
for(int y = 0; y < newImg.getHeight(); y++) {
float[] noise;
double[] 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);

View File

@@ -28,7 +28,7 @@ public class WorldImageGenerator {
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, 4);
float[] noise = tb.getGrid(x, y).getRawNoise(x, y);
double[] noise = tb.getGrid(x, y).getRawNoise(x, y);
Color c = new Color(NormalizationUtil.normalize(noise[0], 256, 4), NormalizationUtil.normalize(noise[1], 256, 4), zone);
draw.setRGB(imX, imY, c.getRGB());
imX++;