mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-04 23:06:05 +00:00
factor in resolution
This commit is contained in:
@@ -20,22 +20,25 @@ public class BiomeHolderImpl implements BiomeHolder {
|
||||
private final double totalWidth;
|
||||
private final int originalWidth;
|
||||
private BiomeDelegate[][] biomes;
|
||||
private final int resolution;
|
||||
|
||||
public BiomeHolderImpl(int width, double totalWidth) {
|
||||
public BiomeHolderImpl(int width, double totalWidth, int resolution) {
|
||||
this.totalWidth = totalWidth;
|
||||
this.originalWidth = width;
|
||||
this.resolution = resolution;
|
||||
width += 4;
|
||||
this.width = width;
|
||||
biomes = new BiomeDelegate[width][width];
|
||||
this.offset = 2;
|
||||
}
|
||||
|
||||
private BiomeHolderImpl(BiomeDelegate[][] biomes, int width, int offset, double totalWidth, int originalWidth) {
|
||||
private BiomeHolderImpl(BiomeDelegate[][] biomes, int width, int offset, double totalWidth, int originalWidth, int resolution) {
|
||||
this.biomes = biomes;
|
||||
this.width = width;
|
||||
this.offset = 2 * offset;
|
||||
this.totalWidth = totalWidth;
|
||||
this.originalWidth = originalWidth;
|
||||
this.resolution = resolution;
|
||||
}
|
||||
|
||||
private double normalise(double in) {
|
||||
@@ -54,18 +57,18 @@ public class BiomeHolderImpl implements BiomeHolder {
|
||||
for(int zi = 0; zi < width; zi++) {
|
||||
biomes[xi * 2][zi * 2] = old[xi][zi];
|
||||
if(zi != width - 1)
|
||||
biomes[xi * 2][zi * 2 + 1] = expander.getBetween(normalise(xi) + x, normalise(zi + 1) + z, seed, old[xi][zi],
|
||||
biomes[xi * 2][zi * 2 + 1] = expander.getBetween((normalise(xi) + x) * resolution, (normalise(zi + 1) + z) * resolution, seed, old[xi][zi],
|
||||
old[xi][zi + 1]);
|
||||
if(xi != width - 1)
|
||||
biomes[xi * 2 + 1][zi * 2] = expander.getBetween(normalise(xi + 1) + x, normalise(zi) + z, seed, old[xi][zi],
|
||||
biomes[xi * 2 + 1][zi * 2] = expander.getBetween((normalise(xi + 1) + x) * resolution, (normalise(zi) + z) * resolution, seed, old[xi][zi],
|
||||
old[xi + 1][zi]);
|
||||
if(xi != width - 1 && zi != width - 1)
|
||||
biomes[xi * 2 + 1][zi * 2 + 1] = expander.getBetween(normalise(xi + 1) + x, normalise(zi + 1) + z, seed,
|
||||
biomes[xi * 2 + 1][zi * 2 + 1] = expander.getBetween((normalise(xi + 1) + x) * resolution, (normalise(zi + 1) + z) * resolution, seed,
|
||||
old[xi][zi],
|
||||
old[xi + 1][zi + 1], old[xi][zi + 1], old[xi + 1][zi]);
|
||||
}
|
||||
}
|
||||
return new BiomeHolderImpl(biomes, newWidth, offset, totalWidth, originalWidth * 2 - 1);
|
||||
return new BiomeHolderImpl(biomes, newWidth, offset, totalWidth, originalWidth * 2 - 1, resolution);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,7 +76,7 @@ public class BiomeHolderImpl implements BiomeHolder {
|
||||
for(int xi = 0; xi < width; xi++) {
|
||||
for(int zi = 0; zi < width; zi++) {
|
||||
BiomeMutator.ViewPoint viewPoint = new BiomeMutator.ViewPoint(this, xi, zi);
|
||||
biomes[xi][zi] = mutator.mutate(viewPoint, normalise(xi) + x, normalise(zi) + z, seed);
|
||||
biomes[xi][zi] = mutator.mutate(viewPoint, (normalise(xi) + x) * resolution, (normalise(zi) + z) * resolution, seed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,7 +85,7 @@ public class BiomeHolderImpl implements BiomeHolder {
|
||||
public void fill(BiomeSource source, int x, int z, long seed) {
|
||||
for(int xi = 0; xi < width; xi++) {
|
||||
for(int zi = 0; zi < width; zi++) {
|
||||
biomes[xi][zi] = source.getBiome(normalise(xi) + x, normalise(zi) + z, seed);
|
||||
biomes[xi][zi] = source.getBiome((normalise(xi) + x) * resolution, (normalise(zi) + z) * resolution, seed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class BiomePipeline {
|
||||
public BiomeHolder getBiomes(int x, int z, long seed) {
|
||||
x *= size;
|
||||
z *= size;
|
||||
BiomeHolder holder = new BiomeHolderImpl(init, size);
|
||||
BiomeHolder holder = new BiomeHolderImpl(init, size, resolution);
|
||||
holder.fill(source, x, z, seed);
|
||||
for(Stage stage : stages) {
|
||||
holder = stage.apply(holder, x, z, seed);
|
||||
|
||||
Reference in New Issue
Block a user