From 1bb4954867ce7b34bcc5c0efc4713ae537d5eaa3 Mon Sep 17 00:00:00 2001 From: dags- Date: Tue, 21 Jan 2020 19:31:59 +0000 Subject: [PATCH] - tidy up block tags - fix biome tag reload causing hang - remove neighbour evaluation in Erosion --- .../main/java/com/terraforged/app/Cache.java | 2 +- .../com/terraforged/core/filter/Erosion.java | 42 +------------------ 2 files changed, 3 insertions(+), 41 deletions(-) diff --git a/TerraForgedApp/src/main/java/com/terraforged/app/Cache.java b/TerraForgedApp/src/main/java/com/terraforged/app/Cache.java index 27e5858..aa31f87 100644 --- a/TerraForgedApp/src/main/java/com/terraforged/app/Cache.java +++ b/TerraForgedApp/src/main/java/com/terraforged/app/Cache.java @@ -32,7 +32,7 @@ public class Cache { this.renderer = RegionGenerator.builder() .factory(new WorldGeneratorFactory(context)) .pool(ThreadPool.getCommon()) - .size(3, 0) + .size(3, 2) .build(); } diff --git a/TerraForgedCore/src/main/java/com/terraforged/core/filter/Erosion.java b/TerraForgedCore/src/main/java/com/terraforged/core/filter/Erosion.java index 0f2f181..04b3e77 100644 --- a/TerraForgedCore/src/main/java/com/terraforged/core/filter/Erosion.java +++ b/TerraForgedCore/src/main/java/com/terraforged/core/filter/Erosion.java @@ -43,11 +43,11 @@ public class Erosion implements Filter { applyMain(map, seedX, seedZ, iterations, random); - applyNeighbours(map, seedX, seedZ, iterations, random); +// applyNeighbours(map, seedX, seedZ, iterations, random); } private int nextCoord(Size size, Random random) { - return size.border + random.nextInt(size.size - 1); + return random.nextInt(size.total - 1); } private void applyMain(Filterable map, int seedX, int seedZ, int iterations, Random random) { @@ -59,44 +59,6 @@ public class Erosion implements Filter { } } - private void applyNeighbours(Filterable map, int centerX, int centerZ, int iterations, Random random) { - PosIterator regions = PosIterator.area(-1, -1, 3, 3); - while (regions.next()) { - int dx = regions.x(); - int dz = regions.z(); - if (dx == 0 && dz == 0) { - continue; - } - int rx = centerX + dx; - int rz = centerZ + dz; - random.setSeed(NoiseUtil.seed(rx, rz)); - applyNeighbour(map, dx, dz, iterations, random); - } - } - - private void applyNeighbour(Filterable map, int deltaX, int deltaZ, int iterations, Random random) { - int min = -map.getSize().border; - int max = map.getSize().size + map.getSize().border - 1; - int neighbourOffsetX = deltaX * map.getSize().size; - int neighbourOffsetZ = deltaZ * map.getSize().size; - while (iterations-- > 0) { - int posX = nextCoord(map.getSize(), random); - int posZ = nextCoord(map.getSize(), random); - int relX = posX + neighbourOffsetX; - int relZ = posZ + neighbourOffsetZ; - - // is inside the border box - if (relX > min && relZ > min && relX < max && relZ < max) { - // shouldn't happen - if (relX > 0 && relZ > 0 && relX < map.getSize().size && relZ < map.getSize().size) { - System.out.println("err?"); - continue; - } - apply(map.getBacking(), relX, relZ, map.getSize().total); - } - } - } - private void apply(Cell[] cells, float posX, float posY, int size) { float dirX = 0; float dirY = 0;