Sea heads fail closed

- Window plans reject sea inlets off sea level, reaches graded below sea level, mouths not at sea level and ponds below sea level, naming the window and feature
- Coastal fractal and cliff coast scenes pin inlet levels, mouth grades, minimum grades and raster mouth and inlet heads at sea level with no sub-sea air
- Hand-built plans with off-sea mouths, sub-sea runs and sunken ponds fail closed
- The coastal fall raster test also runs with a 32-block bank band
- Planned scenes expose their sea inlets and synthetic terrain can be lowered
This commit is contained in:
Brian Neumann-Fopiano committed 2026-11-01 19:50:10 -05:00
1 parent 1cdc30e1ca
commit d341e114b5
5 files changed
+166 -9

No files matched your search

@@ -20,6 +20,7 @@ import art.arcane.iris.generation.hydrology.water.PondKind;
import art.arcane.iris.generation.hydrology.water.PondPlanner;
import art.arcane.iris.generation.hydrology.water.Reach;
import art.arcane.iris.generation.hydrology.water.ReachShaper;
import art.arcane.iris.generation.hydrology.water.ReachStyle;
import art.arcane.iris.generation.hydrology.water.ShapedNetwork;
import java.util.ArrayList;
@@ -120,6 +121,7 @@ public final class WindowPlanner {
List<Pond> windowPonds = windowPonds(network.ponds());
List<SeaInlet> planned = inlets.plan(raw, samples, drainage.receivers(), drainage.accumulation(), network, settings.seed());
WindowPlan owned = new WindowPlan(key, ownedReaches(key, reaches), ownedPonds(key, windowPonds), ownedInlets(key, planned));
requireSeaConnectedHeads(owned, settings.seaLevel());
return new WindowComputation(owned, reaches, windowPonds);
}
@@ -319,6 +321,32 @@ public final class WindowPlanner {
return owned;
}
private static void requireSeaConnectedHeads(WindowPlan plan, int seaLevel) {
for (SeaInlet inlet : plan.inlets()) {
if (inlet.waterLevel() != seaLevel) {
throw new IllegalStateException("Window " + plan.key() + " sea inlet " + inlet.id() + " holds water at " + inlet.waterLevel()
+ ", not at sea level " + seaLevel);
}
}
for (Reach reach : plan.reaches()) {
for (int point = 0; point < reach.grade().length; point++) {
int grade = reach.grade()[point];
boolean mouth = reach.style()[point] == ReachStyle.MOUTH;
if (grade < seaLevel || mouth && grade != seaLevel) {
throw new IllegalStateException("Window " + plan.key() + " reach " + reach.id() + " " + reach.style()[point] + " point "
+ point + " at " + reach.xs()[point] + "," + reach.zs()[point] + " is graded " + grade
+ (mouth ? ", not at sea level " : ", below sea level ") + seaLevel);
}
}
}
for (Pond pond : plan.ponds()) {
if (pond.level() < seaLevel) {
throw new IllegalStateException("Window " + plan.key() + " pond " + pond.id() + " at " + pond.floorX() + "," + pond.floorZ()
+ " stands at " + pond.level() + ", below sea level " + seaLevel);
}
}
}
private record Drainage(float[] filled, List<Basin> basins, DemGrid surface, int[] receivers, float[] accumulation, BitSet channels) {
}
}