This commit is contained in:
ImTallone 2019-03-26 18:06:52 +02:00
commit ee93f9522f

View File

@ -162,14 +162,27 @@ public class Noise {
public static float[][] generateMapFragment(int x, int y, int width, int height, int scale, int seed) { public static float[][] generateMapFragment(int x, int y, int width, int height, int scale, int seed) {
float[][] map = new float[width][height]; float[][] map = new float[width][height];
resolution = scale; float factor = 0.45F;
resolution2 = resolution-1; float sum = 0;
Noise.seed = seed; for(; scale >= 16; scale >>= 1) {
resolution = scale;
resolution2 = resolution-1;
Noise.seed = seed;
for (int x1 = x; x1 < width + x; x1++) {
for (int y1 = y; y1 < height + y; y1++) {
//map[x1 - x][y1 - y] = get2DPerlinNoiseValue(x1, y1, scale, seed);
map[x1 - x][y1 - y] += factor*perlin(x1, y1);
}
}
sum += factor;
factor *= 0.55F;
}
for (int x1 = x; x1 < width + x; x1++) { for (int x1 = x; x1 < width + x; x1++) {
for (int y1 = y; y1 < height + y; y1++) { for (int y1 = y; y1 < height + y; y1++) {
//map[x1 - x][y1 - y] = get2DPerlinNoiseValue(x1, y1, scale, seed); //map[x1 - x][y1 - y] = get2DPerlinNoiseValue(x1, y1, scale, seed);
map[x1 - x][y1 - y] = perlin(x1, y1); map[x1 - x][y1 - y] /= sum;
} }
} }