mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 01:04:29 +00:00
Tune tidal arm shape
- Find the lowest monotone path inland with a wander term, replacing the greedy walk - Scale the meander to arm length and skip slope damping, since arms are cut flat - Remove the steep-ray cone from tidal banks, which made the spiky bank teeth - Round heads, damp width wobble inland and tune the funnel defaults - Narrow territories to the water while keeping mouths apart
This commit is contained in:
9 files changed
+138
-50
No files matched your search
@@ -29,20 +29,20 @@ public class IrisSeaInlets {
|
||||
@MinNumber(2)
|
||||
@MaxNumber(128)
|
||||
@Description("Highest ground in blocks above sea level an inlet may cut through. An arm stops where its banks would pass this height, so lower values keep inlets out of hills.")
|
||||
private int maximumBankHeight = 28;
|
||||
private int maximumBankHeight = 40;
|
||||
|
||||
@ArrayType(type = Double.class, min = 2)
|
||||
@Description("Half-width of the water at the sea in blocks, written as [min, max], each from 2 to 32. The min must not be below headHalfWidth max.")
|
||||
private KList<Double> mouthHalfWidth = new KList<>(10D, 14D);
|
||||
private KList<Double> mouthHalfWidth = new KList<>(13D, 15D);
|
||||
|
||||
@ArrayType(type = Double.class, min = 2)
|
||||
@Description("Half-width of the water at the inland end in blocks, written as [min, max], each from 1 to 8.")
|
||||
private KList<Double> headHalfWidth = new KList<>(2D, 3D);
|
||||
private KList<Double> headHalfWidth = new KList<>(2.5D, 3D);
|
||||
|
||||
@MinNumber(0.5)
|
||||
@MaxNumber(4)
|
||||
@Description("How the width falls from mouth to head. 1 narrows evenly; above 1 stays narrow further from the head and widens late near the sea; below 1 widens early.")
|
||||
private double taper = 1.8D;
|
||||
private double taper = 1.4D;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(0.5)
|
||||
|
||||
@@ -178,7 +178,8 @@ final class RasterComposer {
|
||||
u = BedProfile.position(u, -variation);
|
||||
}
|
||||
if (ground >= surface) {
|
||||
double cone = coneSlope(steepestToWater(x, z, bank, bankEdge)) * u * bankTier.bankBand();
|
||||
double slope = bank.reach.style()[0] == ReachStyle.TIDAL ? settings.deformation().bankSlope() : coneSlope(steepestToWater(x, z, bank, bankEdge));
|
||||
double cone = slope * u * bankTier.bankBand();
|
||||
cut = BankProfile.cut(bankTier.bankStyle(), surface, ground, u, cone, noise(x, z));
|
||||
} else if (ground >= settings.seaLevel()) {
|
||||
raise = BankProfile.levee(bankTier.bankStyle(), surface, ground, u, noise(x, z), settings.deformation().maxFill());
|
||||
|
||||
@@ -44,10 +44,14 @@ final class ReachFitter {
|
||||
}
|
||||
|
||||
Fitted fit(DemGrid grid, int[] cells, float[] cellCatchment, HydrologyTier tier, long shapeSeed, boolean drainsToTheSea) {
|
||||
return fit(grid, cells, cellCatchment, tier, shapeSeed, drainsToTheSea, tier.halfWidth(cellCatchment[cellCatchment.length - 1]), MEANDER_WIDTH_SCALE, true);
|
||||
}
|
||||
|
||||
Fitted fit(DemGrid grid, int[] cells, float[] cellCatchment, HydrologyTier tier, long shapeSeed, boolean drainsToTheSea, float meanderWidth, double amplitudeScale, boolean dampOnSlopes) {
|
||||
float halfWidth = tier.halfWidth(cellCatchment[cellCatchment.length - 1]);
|
||||
Line line = relax(resample(grid, cells, cellCatchment));
|
||||
Tangents tangents = tangents(line.xs(), line.zs());
|
||||
meander(line, tangents, shapeSeed, halfWidth);
|
||||
meander(line, tangents, shapeSeed, meanderWidth, amplitudeScale, dampOnSlopes);
|
||||
int reach = Math.max(2, (int) Math.ceil(Math.max(VALLEY_SNAP, halfWidth + 2f) / SPACING));
|
||||
Reads reads = read(line, tangents, reach);
|
||||
Fitted fitted = place(line, tangents, reads, soften(viterbi(reads, line.xs().length, reach), reads, reach), tier);
|
||||
@@ -159,7 +163,7 @@ final class ReachFitter {
|
||||
return spaced;
|
||||
}
|
||||
|
||||
private void meander(Line line, Tangents tangents, long shapeSeed, float halfWidth) {
|
||||
private void meander(Line line, Tangents tangents, long shapeSeed, float halfWidth, double amplitudeScale, boolean dampOnSlopes) {
|
||||
int count = line.xs().length;
|
||||
if (count < 3) {
|
||||
return;
|
||||
@@ -168,11 +172,11 @@ final class ReachFitter {
|
||||
for (int wave = 0; wave < phase.length; wave++) {
|
||||
phase[wave] = 2D * Math.PI * CellHash.unit(CellHash.mix(shapeSeed, SALT_MEANDER, wave, 0));
|
||||
}
|
||||
double amplitude = Math.clamp(MEANDER_WIDTH_SCALE * (halfWidth + 1f), MEANDER_MIN, MEANDER_MAX);
|
||||
double amplitude = Math.clamp(amplitudeScale * (halfWidth + 1f), MEANDER_MIN, MEANDER_MAX);
|
||||
double wavelength = Math.clamp(MEANDER_WAVELENGTH_WIDTHS * 2D * (halfWidth + 1f), MEANDER_WAVELENGTH_MIN, MEANDER_WAVELENGTH_MAX);
|
||||
double ramp = Math.min(line.length() / 2D, wavelength / 2D);
|
||||
float[] open = awayFromPonds(line, tangents, (float) amplitude + halfWidth + SHORE_MARGIN);
|
||||
double[] damping = slopeDamping(line);
|
||||
double[] damping = dampOnSlopes ? slopeDamping(line) : null;
|
||||
float[] offsets = new float[count];
|
||||
for (int point = 1; point < count - 1; point++) {
|
||||
double s = line.distance()[point];
|
||||
@@ -181,7 +185,7 @@ final class ReachFitter {
|
||||
wave += MEANDER_WAVE_WEIGHTS[index] * StrictMath.sin(2D * Math.PI * s / (wavelength * MEANDER_WAVE_SCALES[index]) + phase[index]);
|
||||
}
|
||||
double envelope = smoothstep(s / ramp) * smoothstep((line.length() - s) / ramp);
|
||||
offsets[point] = (float) (amplitude * envelope * damping[point] * wave * open[point]);
|
||||
offsets[point] = (float) (amplitude * envelope * (damping == null ? 1D : damping[point]) * wave * open[point]);
|
||||
}
|
||||
for (int point = 1; point < count - 1; point++) {
|
||||
line.xs()[point] -= offsets[point] * tangents.z()[point];
|
||||
|
||||
@@ -11,10 +11,12 @@ import art.arcane.iris.generation.hydrology.plan.WindowPlanner;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.PriorityQueue;
|
||||
|
||||
public final class TidalPlanner {
|
||||
private static final int CELL = WindowPlanner.CELL;
|
||||
@@ -24,9 +26,8 @@ public final class TidalPlanner {
|
||||
private static final int BUILD_ATTEMPTS = 8;
|
||||
private static final int TRIM_PASSES = 3;
|
||||
private static final float MOUTH_ZONE = 32f;
|
||||
private static final float END_SHARE = 0.5f;
|
||||
private static final float END_SHARE = 0.4f;
|
||||
private static final float DIAGONAL = 1.41421356f;
|
||||
private static final float VALLEY_WEIGHT = 0.5f;
|
||||
private static final float BESIDE_SEA_MARGIN = 10f;
|
||||
private static final float BESIDE_SEA_SHARE = 0.4f;
|
||||
private static final float TIP_LENGTH = 12f;
|
||||
@@ -34,6 +35,7 @@ public final class TidalPlanner {
|
||||
private static final float SHOAL_LENGTH = 16f;
|
||||
private static final float DEEP_SHARE = 0.5f;
|
||||
private static final float SCAN_STEP = 8f;
|
||||
private static final float HEAD_WOBBLE = 0.4f;
|
||||
private static final float WOBBLE_LONG = 57f;
|
||||
private static final float WOBBLE_SHORT = 23f;
|
||||
private static final float BESIDE_NEAR = 1f;
|
||||
@@ -42,6 +44,13 @@ public final class TidalPlanner {
|
||||
private static final int LOW_RIVER = 2;
|
||||
private static final float LOW_RIVER_BAND = 4f;
|
||||
private static final float WALK_WIDTH = 4f;
|
||||
private static final float TERRITORY_MARGIN = 8f;
|
||||
private static final float WANDER = 12f;
|
||||
private static final float WANDER_CELLS = 5f;
|
||||
private static final float WAVES_PER_LENGTH = 0.5f;
|
||||
private static final float WAVELENGTH_WIDTHS = 24f;
|
||||
private static final double MEANDER_SCALE = 3.5D;
|
||||
private static final long SALT_WANDER = 0x5449444c574eL;
|
||||
private static final long SALT_RANK = 0x5449444c524bL;
|
||||
private static final long SALT_ID = 0x5449444c4944L;
|
||||
private static final long SALT_SITE = 0x5449444c53L;
|
||||
@@ -61,6 +70,7 @@ public final class TidalPlanner {
|
||||
private final int stride;
|
||||
private final long seed;
|
||||
private final float territory;
|
||||
private final float mouthSpacing;
|
||||
private final Map<Long, Anchor> anchors = new LinkedHashMap<>(MEMO_SITES, 0.75f, true) {
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Map.Entry<Long, Anchor> eldest) {
|
||||
@@ -74,7 +84,8 @@ public final class TidalPlanner {
|
||||
this.fine = Objects.requireNonNull(fine, "fine");
|
||||
this.stride = CELL / fine.cell();
|
||||
this.seed = settings.seed();
|
||||
this.territory = 2f * config.mouthHalfWidth().max() + config.bankBand();
|
||||
this.territory = config.mouthHalfWidth().max() + config.headHalfWidth().max() + TERRITORY_MARGIN;
|
||||
this.mouthSpacing = 2f * config.mouthHalfWidth().max() + config.bankBand();
|
||||
}
|
||||
|
||||
public List<Reach> plan(WindowKey window, DemGrid natural, HydrologySampleBuffer samples, ShapedNetwork network) {
|
||||
@@ -176,7 +187,7 @@ public final class TidalPlanner {
|
||||
}
|
||||
|
||||
private List<Anchor> rivals(Anchor anchor) {
|
||||
double reach = 2D * (config.length().max() + 2 * CELL) + territory;
|
||||
double reach = 2D * (config.length().max() + 2 * CELL) + mouthSpacing;
|
||||
int spacing = config.spacing();
|
||||
int minSiteX = Math.floorDiv((int) Math.floor(anchor.x() - reach), spacing);
|
||||
int maxSiteX = Math.floorDiv((int) Math.ceil(anchor.x() + reach), spacing);
|
||||
@@ -196,7 +207,7 @@ public final class TidalPlanner {
|
||||
|
||||
private boolean suppressed(Anchor anchor, List<Anchor> rivals) {
|
||||
for (Anchor rival : rivals) {
|
||||
if (rival.rank() < anchor.rank() && Math.hypot(rival.x() - anchor.x(), rival.z() - anchor.z()) < territory) {
|
||||
if (rival.rank() < anchor.rank() && Math.hypot(rival.x() - anchor.x(), rival.z() - anchor.z()) < mouthSpacing) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -365,17 +376,32 @@ public final class TidalPlanner {
|
||||
int mouth = mouth(land, start);
|
||||
double unit = CellHash.unit(CellHash.mix(seed, SALT_LENGTH, grid.blockX(start), grid.blockZ(start)));
|
||||
float target = (float) (config.length().min() + (config.length().max() - config.length().min()) * unit);
|
||||
List<Integer> path = new ArrayList<>();
|
||||
path.add(mouth);
|
||||
path.add(start);
|
||||
int current = start;
|
||||
float length = CELL;
|
||||
float[] height = land.samples().height();
|
||||
while (length < target) {
|
||||
Map<Integer, Step> reached = new HashMap<>();
|
||||
reached.put(start, new Step(-1, 0f, CELL));
|
||||
PriorityQueue<Integer> frontier = new PriorityQueue<>(Comparator.comparingDouble((Integer cell) -> coast[cell]).thenComparingInt(cell -> cell));
|
||||
frontier.add(start);
|
||||
int chosen = start;
|
||||
float chosenCost = Float.POSITIVE_INFINITY;
|
||||
float longest = CELL;
|
||||
while (!frontier.isEmpty()) {
|
||||
int current = frontier.poll();
|
||||
Step step = reached.get(current);
|
||||
if (step.length() >= target) {
|
||||
float cost = step.cost() / step.length();
|
||||
if (longest < target || cost < chosenCost) {
|
||||
chosen = current;
|
||||
chosenCost = cost;
|
||||
longest = step.length();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (longest < target && step.length() > longest) {
|
||||
longest = step.length();
|
||||
chosen = current;
|
||||
}
|
||||
int i = current % grid.width();
|
||||
int j = current / grid.width();
|
||||
int best = -1;
|
||||
float bestScore = Float.POSITIVE_INFINITY;
|
||||
for (int dj = -1; dj <= 1; dj++) {
|
||||
for (int di = -1; di <= 1; di++) {
|
||||
int ni = i + di;
|
||||
@@ -387,30 +413,47 @@ public final class TidalPlanner {
|
||||
if (coast[next] <= coast[current] || wet[next] || !open(land, next) || !inTerritory(anchor, rivals, grid.blockX(next), grid.blockZ(next))) {
|
||||
continue;
|
||||
}
|
||||
float score = height[next] - VALLEY_WEIGHT * (coast[next] - coast[current]);
|
||||
if (score < bestScore || score == bestScore && next < best) {
|
||||
bestScore = score;
|
||||
best = next;
|
||||
float span = di != 0 && dj != 0 ? CELL * DIAGONAL : CELL;
|
||||
float cost = step.cost() + span * (height[next] - settings.seaLevel() + wander(grid.blockX(next), grid.blockZ(next)));
|
||||
Step known = reached.get(next);
|
||||
if (known == null) {
|
||||
frontier.add(next);
|
||||
}
|
||||
if (known == null || cost < known.cost()) {
|
||||
reached.put(next, new Step(current, cost, step.length() + span));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (best < 0) {
|
||||
break;
|
||||
}
|
||||
length += (float) Math.hypot(grid.blockX(best) - grid.blockX(current), grid.blockZ(best) - grid.blockZ(current));
|
||||
path.add(best);
|
||||
current = best;
|
||||
}
|
||||
if (length < config.length().min() || coast[current] < END_SHARE * length) {
|
||||
float length = reached.get(chosen).length();
|
||||
if (length < config.length().min() || coast[chosen] < END_SHARE * length) {
|
||||
return null;
|
||||
}
|
||||
int[] cells = new int[path.size()];
|
||||
for (int index = 0; index < cells.length; index++) {
|
||||
cells[index] = path.get(cells.length - 1 - index);
|
||||
List<Integer> path = new ArrayList<>();
|
||||
for (int cell = chosen; cell >= 0; cell = reached.get(cell).from()) {
|
||||
path.add(cell);
|
||||
}
|
||||
int[] cells = new int[path.size() + 1];
|
||||
for (int index = 0; index < path.size(); index++) {
|
||||
cells[index] = path.get(index);
|
||||
}
|
||||
cells[path.size()] = mouth;
|
||||
return cells;
|
||||
}
|
||||
|
||||
private float wander(int x, int z) {
|
||||
float size = WANDER_CELLS * CELL;
|
||||
int ix = (int) Math.floor(x / size);
|
||||
int iz = (int) Math.floor(z / size);
|
||||
float u = x / size - ix;
|
||||
float v = z / size - iz;
|
||||
float a = (float) CellHash.unit(CellHash.mix(seed, SALT_WANDER, ix, iz));
|
||||
float b = (float) CellHash.unit(CellHash.mix(seed, SALT_WANDER, ix + 1, iz));
|
||||
float c = (float) CellHash.unit(CellHash.mix(seed, SALT_WANDER, ix, iz + 1));
|
||||
float d = (float) CellHash.unit(CellHash.mix(seed, SALT_WANDER, ix + 1, iz + 1));
|
||||
return WANDER * ((a + (b - a) * u) * (1f - v) + (c + (d - c) * u) * v);
|
||||
}
|
||||
|
||||
private Reach shape(Land land, int[] cells, Anchor anchor, List<Anchor> rivals, ReachFitter fitter, ShapedNetwork network) {
|
||||
DemGrid grid = land.grid();
|
||||
int last = cells.length - 1;
|
||||
@@ -421,7 +464,12 @@ public final class TidalPlanner {
|
||||
long id = CellHash.mix(CellHash.mix(seed, SALT_ID, mouthX, mouthZ), SALT_SITE, startX, startZ);
|
||||
long shape = CellHash.mix(id, SALT_SHAPE, 0, 0);
|
||||
HydrologyTier tier = settings.tidalTier();
|
||||
ReachFitter.Fitted fitted = fitter.fit(grid, cells, new float[cells.length], tier, shape, true);
|
||||
float walked = 0f;
|
||||
for (int index = 1; index < cells.length; index++) {
|
||||
walked += (float) Math.hypot(grid.blockX(cells[index]) - grid.blockX(cells[index - 1]), grid.blockZ(cells[index]) - grid.blockZ(cells[index - 1]));
|
||||
}
|
||||
float meanderWidth = Math.clamp(walked * WAVES_PER_LENGTH / WAVELENGTH_WIDTHS - 1f, 1f, config.meanderWidth());
|
||||
ReachFitter.Fitted fitted = fitter.fit(grid, cells, new float[cells.length], tier, shape, true, meanderWidth, MEANDER_SCALE, false);
|
||||
ReachDraft draft = new ReachDraft(new ReachTracer.Chain(cells, ReachTracer.End.OCEAN, -1), id, tier, 0f, Integer.MIN_VALUE, fitted);
|
||||
draft.grade = new int[draft.xs.length];
|
||||
Arrays.fill(draft.grade, settings.seaLevel());
|
||||
@@ -536,7 +584,7 @@ public final class TidalPlanner {
|
||||
double funnel = head + (mouth - head) * Math.pow(t, config.taper());
|
||||
double wobble = 0.65D * StrictMath.sin(2D * Math.PI * (s / WOBBLE_LONG + phaseLong)) + 0.35D * StrictMath.sin(2D * Math.PI * (s / WOBBLE_SHORT + phaseShort));
|
||||
double ends = Math.min(1f, Math.min(s, total - s) / TIP_LENGTH);
|
||||
double shaped = funnel * (1D + config.widthVariation() * ends * wobble);
|
||||
double shaped = funnel * (1D + config.widthVariation() * ends * (HEAD_WOBBLE + (1f - HEAD_WOBBLE) * t) * wobble);
|
||||
double tip = TIP_HALF_WIDTH + (shaped - TIP_HALF_WIDTH) * Math.min(1f, s / TIP_LENGTH);
|
||||
widths[point] = (float) Math.max(TIP_HALF_WIDTH, point == distance.length - 1 ? mouth : tip);
|
||||
}
|
||||
@@ -601,7 +649,7 @@ public final class TidalPlanner {
|
||||
boolean ocean = samples.ocean()[index];
|
||||
boolean near = index < 4 || index == offsets.length;
|
||||
boolean far = index >= 4 && index < offsets.length;
|
||||
float allowed = far ? limit + 0.5f * band : limit;
|
||||
float allowed = far ? limit + band : limit;
|
||||
bad = !ocean && (samples.height()[index] > allowed || near && total - distance[point] > MOUTH_ZONE && samples.height()[index] < sea);
|
||||
}
|
||||
if (bad) {
|
||||
@@ -658,6 +706,9 @@ public final class TidalPlanner {
|
||||
}
|
||||
}
|
||||
|
||||
private record Step(int from, float cost, float length) {
|
||||
}
|
||||
|
||||
private record Land(DemGrid grid, HydrologySampleBuffer samples) {
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class IrisHydrologyDefaultsTest {
|
||||
"lakes": { "enabled": true, "minArea": 65536, "maxArea": 4194304 },
|
||||
"deformation": { "maxFill": 6, "bankSlope": 0.2, "bankSteepFactor": 3.5, "bankNoise": 0.2, "caveMask": true },
|
||||
"underground": {
|
||||
"seaInlets": { "enabled": true, "spacing": 192, "length": [64, 256], "maximumBankHeight": 28, "mouthHalfWidth": [10, 14], "headHalfWidth": [2, 3], "taper": 1.8, "widthVariation": 0.18, "meanderWidth": 4, "depth": [2, 5], "bankBand": 24, "bankStyle": "SMOOTH" },
|
||||
"seaInlets": { "enabled": true, "spacing": 192, "length": [64, 256], "maximumBankHeight": 40, "mouthHalfWidth": [13, 15], "headHalfWidth": [2.5, 3], "taper": 1.4, "widthVariation": 0.18, "meanderWidth": 4, "depth": [2, 5], "bankBand": 24, "bankStyle": "SMOOTH" },
|
||||
"cavePools": { "enabled": true, "density": 0.15, "minArea": 6, "maxArea": 400, "maxDepth": 4, "radius": 15, "freeboard": [0, 1], "fluid": "water" }
|
||||
},
|
||||
"fluids": [ { "name": "water", "palette": { "palette": [ { "block": "minecraft:water" } ] } } ],
|
||||
|
||||
+6
-6
@@ -38,7 +38,7 @@ public class HydrologySettingsTest {
|
||||
private static final int SEA_LEVEL = 62;
|
||||
private static final int MIN_Y = -64;
|
||||
private static final int MAX_Y = 320;
|
||||
private static final long DEFAULT_FINGERPRINT = -6680786385526424170L;
|
||||
private static final long DEFAULT_FINGERPRINT = 7426172183353655598L;
|
||||
|
||||
@Test
|
||||
public void densityIsBoundedAndChangesThePlanIdentity() {
|
||||
@@ -717,10 +717,10 @@ public class HydrologySettingsTest {
|
||||
assertTrue(inlets.enabled());
|
||||
assertEquals(192, inlets.spacing());
|
||||
assertEquals(new HydrologySettings.IntRange(64, 256), inlets.length());
|
||||
assertEquals(28, inlets.maximumBankHeight());
|
||||
assertEquals(new HydrologySettings.FloatRange(10f, 14f), inlets.mouthHalfWidth());
|
||||
assertEquals(new HydrologySettings.FloatRange(2f, 3f), inlets.headHalfWidth());
|
||||
assertEquals(1.8f, inlets.taper(), 0f);
|
||||
assertEquals(40, inlets.maximumBankHeight());
|
||||
assertEquals(new HydrologySettings.FloatRange(13f, 15f), inlets.mouthHalfWidth());
|
||||
assertEquals(new HydrologySettings.FloatRange(2.5f, 3f), inlets.headHalfWidth());
|
||||
assertEquals(1.4f, inlets.taper(), 0f);
|
||||
assertEquals(0.18f, inlets.widthVariation(), 1e-6f);
|
||||
assertEquals(4f, inlets.meanderWidth(), 0f);
|
||||
assertEquals(new HydrologySettings.IntRange(2, 5), inlets.depth());
|
||||
@@ -766,7 +766,7 @@ public class HydrologySettingsTest {
|
||||
|
||||
@Test
|
||||
public void overLongSeaInletsFailAtCompile() {
|
||||
compile(inlets(config -> config.setLength(new KList<>(64, 447)).setMouthHalfWidth(new KList<>(10D, 16D)).setBankBand(24)));
|
||||
compile(inlets(config -> config.setLength(new KList<>(64, 447)).setMouthHalfWidth(new KList<>(11D, 16D)).setBankBand(24)));
|
||||
IllegalArgumentException failure = assertThrows(IllegalArgumentException.class,
|
||||
() -> compile(inlets(config -> config.setLength(new KList<>(64, 512)))));
|
||||
assertTrue(failure.getMessage(), failure.getMessage().contains("underground.seaInlets"));
|
||||
|
||||
@@ -111,7 +111,7 @@ public class TidalPlannerTest {
|
||||
|
||||
@Test
|
||||
public void tallCoastsHoldNoArms() {
|
||||
assertTrue(arms(planner(settings(), SyntheticTerrain.cliffCoast(COAST_X))).isEmpty());
|
||||
assertTrue(arms(planner(settings(), SyntheticTerrain.cliffCoast(COAST_X).lowered(-30D))).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -267,7 +267,7 @@ public class TidalPlannerTest {
|
||||
for (int q = 0; q < second.xs().length; q += 2) {
|
||||
double apart = Math.hypot(first.xs()[p] - second.xs()[q], first.zs()[p] - second.zs()[q]);
|
||||
assertTrue(first + " and " + second + " come within " + apart,
|
||||
apart >= first.halfWidth()[p] + second.halfWidth()[q] + settings.underground().seaInlets().bankBand());
|
||||
apart >= first.halfWidth()[p] + second.halfWidth()[q]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+32
@@ -414,6 +414,38 @@ public class ChunkWaterRasterTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tidalBanksFollowTheBandInsteadOfCuttingRaysToSteepGround() {
|
||||
HydrologySettings settings = settings(new IrisHydrology());
|
||||
int points = 9;
|
||||
float[] xs = new float[points];
|
||||
float[] zs = new float[points];
|
||||
int[] grade = new int[points];
|
||||
float[] halfWidth = new float[points];
|
||||
float[] depth = new float[points];
|
||||
ReachStyle[] style = new ReachStyle[points];
|
||||
for (int point = 0; point < points; point++) {
|
||||
xs[point] = -16f + point * 8f;
|
||||
zs[point] = -8f;
|
||||
grade[point] = SEA_LEVEL;
|
||||
halfWidth[point] = 3f;
|
||||
depth[point] = 3f;
|
||||
style[point] = ReachStyle.TIDAL;
|
||||
}
|
||||
Reach reach = new Reach(71L, settings.tidalTier(), 0L, xs, zs, grade, halfWidth, depth, style, 0f);
|
||||
WindowKey key = new WindowKey(0, 0);
|
||||
IndexedWindow own = new IndexedWindow(new WindowPlan(key, List.of(reach), List.of()), ReachIndex.build(key, List.of(reach), List.of()));
|
||||
ChunkRasterizer rasterizer = new ChunkRasterizer(settings, ChannelFluids.TIER);
|
||||
ChunkWaterRaster ridged = rasterizer.rasterize(0, 0, (x, z) -> SEA_LEVEL + 20 + (Math.floorMod(x, 8) < 2 ? 8 : 0), List.of(own), regions(0, 0, List.of()));
|
||||
ChunkWaterRaster plain = rasterizer.rasterize(0, 0, (x, z) -> SEA_LEVEL + 28, List.of(own), regions(0, 0, List.of()));
|
||||
for (int lz = 0; lz < 16; lz++) {
|
||||
for (int lx = 0; lx < 16; lx++) {
|
||||
assertTrue("a ridge reaches no higher than the same band over plain ground at " + lx + "," + lz + ": "
|
||||
+ ridged.terrainHeight(lx, lz) + " over " + plain.terrainHeight(lx, lz), ridged.terrainHeight(lx, lz) <= plain.terrainHeight(lx, lz));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tidalReachColumnsTakeTheInletRoleAtSeaLevelBetweenBanks() {
|
||||
HydrologySettings settings = settings(new IrisHydrology());
|
||||
|
||||
@@ -84,7 +84,7 @@ public class SchemaBuilderIdentityTest {
|
||||
@ClassRule
|
||||
public static final PlatformLeakGuard PLATFORM_GUARD = PlatformLeakGuard.clean();
|
||||
|
||||
private static final String EXPECTED_SCHEMA_DIGEST = "a900bb5a9f8685d8bd8d28d0abaed52010cbd748053368f4b399f969e6b25178";
|
||||
private static final String EXPECTED_SCHEMA_DIGEST = "deb2538c92e5801beea672d32ded75301a441cf36d102bb09474f1c16f7821cc";
|
||||
|
||||
private static final List<Class<?>> SCHEMA_ROOTS = List.of(
|
||||
IrisDimension.class,
|
||||
|
||||
Reference in new issue
Block a user