mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 09:15:27 +00:00
Step height knob
- Add tier stepHeight 1..2, default 2, in the settings fingerprint - Snap channel heads by tier and keep ponds, lakes and inlets at 2 - Key riffle crests on any lower neighbour, falls unchanged - Start one-block outlets at their pond's surface - Reject tiers with a larger step than the next larger tier - Recapture the fingerprint and schema digest
This commit is contained in:
28 files changed
+206
-75
No files matched your search
+1
-1
@@ -142,7 +142,7 @@ public class HydrologyPlanCodecTest {
|
||||
HydrologyPlanCodec.decodeWindow(settings, damaged);
|
||||
}
|
||||
|
||||
HydrologyTier foreign = new HydrologyTier("foreign", 0f, 1f, 2f, 1f, 0.4f, 1, true, 6, 0, IrisBankStyle.SMOOTH,
|
||||
HydrologyTier foreign = new HydrologyTier("foreign", 0f, 1f, 2f, 1f, 0.4f, 1, true, 6, 2, 0, IrisBankStyle.SMOOTH,
|
||||
new HydrologyTier.Estuary(48, 2.5f), new HydrologyTier.Delta(0, 35f, 64), new IrisHydrologyMaterials(), "water", List.of());
|
||||
Reach stray = new Reach(6L, foreign, -1L, new float[]{1f, 2f}, new float[]{1f, 2f}, new int[]{1, 1}, new float[]{1f, 1f},
|
||||
new float[]{1f, 1f}, new ReachStyle[]{ReachStyle.RUN, ReachStyle.RUN}, 1f);
|
||||
|
||||
+33
-1
@@ -5,6 +5,7 @@ import art.arcane.iris.generation.decoration.IrisDecorationPart;
|
||||
import art.arcane.iris.generation.decoration.IrisDecorator;
|
||||
import art.arcane.iris.generation.hydrology.config.IrisFluidProfile;
|
||||
import art.arcane.iris.generation.hydrology.config.IrisHydrology;
|
||||
import art.arcane.iris.generation.hydrology.config.IrisHydrologyTier;
|
||||
import art.arcane.iris.generation.hydrology.config.IrisHydrologyMaterials;
|
||||
import art.arcane.iris.generation.hydrology.water.HydrologyTier;
|
||||
import art.arcane.iris.generation.terrain.IrisMaterialPalette;
|
||||
@@ -25,6 +26,7 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@@ -33,7 +35,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 = 7576271788988330967L;
|
||||
private static final long DEFAULT_FINGERPRINT = -2376958294785826560L;
|
||||
|
||||
@Test
|
||||
public void densityIsBoundedAndChangesThePlanIdentity() {
|
||||
@@ -266,6 +268,36 @@ public class HydrologySettingsTest {
|
||||
assertEquals("fingerprint must be identical in every JVM run", DEFAULT_FINGERPRINT, first);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stepHeightIsBoundedAndChangesThePlanIdentity() {
|
||||
HydrologySettings defaults = compile(new IrisHydrology());
|
||||
defaults.tiers().forEach(tier -> assertEquals(tier.name(), 2, tier.stepHeight()));
|
||||
IrisHydrology fine = new IrisHydrology();
|
||||
fine.getTiers().forEach(tier -> tier.setStepHeight(1));
|
||||
HydrologySettings compiled = compile(fine);
|
||||
compiled.tiers().forEach(tier -> assertEquals(tier.name(), 1, tier.stepHeight()));
|
||||
assertNotEquals(defaults.fingerprint(), compiled.fingerprint());
|
||||
for (int outside : new int[]{0, 3}) {
|
||||
IrisHydrology config = new IrisHydrology();
|
||||
config.getTiers().get(0).setStepHeight(outside);
|
||||
IllegalArgumentException failure = assertThrows(IllegalArgumentException.class, () -> compile(config));
|
||||
assertTrue(failure.getMessage(), failure.getMessage().contains("stepHeight"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aLargerTierCannotTakeASmallerStepThanItsFeeders() {
|
||||
IrisHydrology streamsOnly = new IrisHydrology();
|
||||
streamsOnly.setTiers(new KList<>(new IrisHydrologyTier().setName("stream").setStepHeight(1),
|
||||
new IrisHydrologyTier().setName("river").setMinCatchment(20000D).setHalfWidth(new KList<>(2D, 8D)).setStepHeight(2)));
|
||||
assertEquals(1, compile(streamsOnly).tiers().get(0).stepHeight());
|
||||
IrisHydrology upsideDown = new IrisHydrology();
|
||||
upsideDown.setTiers(new KList<>(new IrisHydrologyTier().setName("stream").setStepHeight(2),
|
||||
new IrisHydrologyTier().setName("river").setMinCatchment(20000D).setHalfWidth(new KList<>(2D, 8D)).setStepHeight(1)));
|
||||
IllegalArgumentException failure = assertThrows(IllegalArgumentException.class, () -> compile(upsideDown));
|
||||
assertTrue(failure.getMessage(), failure.getMessage().contains("stepHeight"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void schedulingKnobsDoNotChangeTheFingerprint() {
|
||||
HydrologySettings eager = compile(new IrisHydrology().setPrefetchRings(4));
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package art.arcane.iris.generation.hydrology.plan;
|
||||
|
||||
import art.arcane.iris.generation.hydrology.config.IrisHydrology;
|
||||
import art.arcane.iris.generation.hydrology.raster.WaterHeads;
|
||||
import art.arcane.iris.generation.hydrology.water.ConfluenceGrader;
|
||||
import art.arcane.iris.generation.hydrology.water.HydrologyTier;
|
||||
import art.arcane.iris.generation.hydrology.water.Pond;
|
||||
@@ -41,6 +43,35 @@ public class PlannedSceneTest {
|
||||
WaterInvariants.detachedOutlets(openFractal()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void oneBlockTiersKeepOutletsAndConfluencesConnected() {
|
||||
IrisHydrology config = PlannedScene.packConfig();
|
||||
config.getTiers().forEach(tier -> tier.setStepHeight(1).setCascades(false));
|
||||
HydrologySettings settings = HydrologySettings.compile(config, SEED, SEA_LEVEL, SyntheticTerrain.MIN_Y, SyntheticTerrain.MAX_Y);
|
||||
PlannedScene scene = PlannedScene.plan(SyntheticTerrain.openFractal(1L).withRainfall((x, z) -> RAINFALL), settings, 2, 2);
|
||||
assertEquals("detached outlets", List.of(), WaterInvariants.detachedOutlets(scene));
|
||||
assertEquals("confluence tongues", List.of(), WaterInvariants.confluenceTongues(scene));
|
||||
Map<Long, Reach> byId = new HashMap<>();
|
||||
int oneBlockDrops = 0;
|
||||
for (Reach reach : scene.reaches()) {
|
||||
byId.put(reach.id(), reach);
|
||||
for (int point = 1; point < reach.grade().length; point++) {
|
||||
oneBlockDrops += reach.grade()[point - 1] - reach.grade()[point] == 1 ? 1 : 0;
|
||||
}
|
||||
}
|
||||
assertTrue("one-block drops in the plan " + oneBlockDrops, oneBlockDrops > 100);
|
||||
int outlets = 0;
|
||||
for (Pond pond : scene.ponds()) {
|
||||
Reach outlet = byId.get(pond.outletReachId());
|
||||
if (outlet != null) {
|
||||
outlets++;
|
||||
assertTrue("outlet " + outlet.id() + " starts at " + outlet.grade()[0] + " above its pond's surface " + WaterHeads.standing(pond.level(), SEA_LEVEL),
|
||||
outlet.grade()[0] <= WaterHeads.standing(pond.level(), SEA_LEVEL));
|
||||
}
|
||||
}
|
||||
assertTrue("outlets checked " + outlets, outlets > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void confluencesHaveNoTongues() {
|
||||
assertEquals("confluence tongues on openFractal(1) with rainfall " + RAINFALL + " over 2x2 windows", List.of(),
|
||||
@@ -308,7 +339,7 @@ public class PlannedSceneTest {
|
||||
}
|
||||
zone[point] = along <= OUTLET_LENGTH;
|
||||
}
|
||||
ReachStyle[] style = ReachShaper.styles(reach.grade(), new boolean[zone.length], zone, reach.tier().waterfallMinimumDrop(), seaLevel);
|
||||
ReachStyle[] style = ReachShaper.styles(reach.grade(), new boolean[zone.length], zone, reach.tier().waterfallMinimumDrop(), seaLevel, reach.tier().stepHeight());
|
||||
return new Reach(reach.id(), reach.tier(), reach.downstreamId(), reach.xs(), reach.zs(), reach.grade(), reach.halfWidth(), reach.depth(),
|
||||
style, reach.catchment());
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ final class WaterInvariants {
|
||||
List<Long> detached = new ArrayList<>();
|
||||
for (Pond pond : checkedPonds(scene)) {
|
||||
Reach outlet = reaches.get(pond.outletReachId());
|
||||
if (!floodsIntoOutlet(scene, pond, outlet, WaterHeads.snap(pond.level(), seaLevel))) {
|
||||
if (!floodsIntoOutlet(scene, pond, outlet, WaterHeads.standing(pond.level(), seaLevel))) {
|
||||
detached.add(outlet.id());
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ final class WaterInvariants {
|
||||
if (box != null) {
|
||||
boolean heldStart = feeders.containsKey(feeder.id()) && feeder.grade()[0] - level > ConfluenceGrader.MAX_START_LOWERING;
|
||||
boolean[] held = held(feeder, lips.getOrDefault(feeder.id(), List.of()), heldStart);
|
||||
junctions.add(new Junction(feeder, WaterHeads.snap(level, seaLevel), pool, held, box));
|
||||
junctions.add(new Junction(feeder, WaterHeads.snap(level, seaLevel, feeder.tier().stepHeight()), pool, held, box));
|
||||
}
|
||||
}
|
||||
return junctions;
|
||||
@@ -159,7 +159,7 @@ final class WaterInvariants {
|
||||
|
||||
private static boolean perched(PlannedScene scene, Junction junction, int seaLevel) {
|
||||
Reach feeder = junction.feeder();
|
||||
boolean endsAtTheJunction = WaterHeads.snap(feeder.grade()[feeder.grade().length - 1], seaLevel) <= junction.head();
|
||||
boolean endsAtTheJunction = WaterHeads.snap(feeder.grade()[feeder.grade().length - 1], seaLevel, feeder.tier().stepHeight()) <= junction.head();
|
||||
int[] box = junction.box();
|
||||
for (int z = box[1]; z <= box[3]; z++) {
|
||||
for (int x = box[0]; x <= box[2]; x++) {
|
||||
@@ -231,7 +231,7 @@ final class WaterInvariants {
|
||||
|
||||
private static boolean fallsToTheJunction(Reach feeder, int point, int seaLevel) {
|
||||
for (int next = point + 1; next < feeder.grade().length; next++) {
|
||||
boolean step = WaterHeads.snap(feeder.grade()[next], seaLevel) < WaterHeads.snap(feeder.grade()[next - 1], seaLevel);
|
||||
boolean step = WaterHeads.snap(feeder.grade()[next], seaLevel, feeder.tier().stepHeight()) < WaterHeads.snap(feeder.grade()[next - 1], seaLevel, feeder.tier().stepHeight());
|
||||
ReachStyle style = feeder.style()[next];
|
||||
if (step && style != ReachStyle.CASCADE && style != ReachStyle.WATERFALL) {
|
||||
return false;
|
||||
|
||||
@@ -692,7 +692,7 @@ public class WindowPlannerTest {
|
||||
leading++;
|
||||
}
|
||||
assertTrue(pond + " outlet " + outlet.id() + " starts off its shore at " + outlet.xs()[0] + "," + outlet.zs()[0], leading > 0);
|
||||
int head = WaterHeads.snap(pond.level(), SEA_LEVEL);
|
||||
int head = WaterHeads.standing(pond.level(), SEA_LEVEL);
|
||||
for (int segment = 0; segment < leading; segment++) {
|
||||
int[] box = segmentBox(outlet, segment);
|
||||
for (int z = box[1]; z <= box[3]; z++) {
|
||||
@@ -700,7 +700,7 @@ public class WindowPlannerTest {
|
||||
int[] covering = nearestCovering(outlet, x, z);
|
||||
if (covering[0] == segment && onShore(mask, x, z)) {
|
||||
assertEquals(pond + " outlet " + outlet.id() + " water at " + x + "," + z, head,
|
||||
WaterHeads.snap(outlet.grade()[covering[1]], SEA_LEVEL));
|
||||
WaterHeads.snap(outlet.grade()[covering[1]], SEA_LEVEL, outlet.tier().stepHeight()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+47
-6
@@ -925,7 +925,7 @@ public class ChunkWaterRasterTest {
|
||||
for (int point = 0; point < zone.length; point++) {
|
||||
zone[point] = drawn.xs()[point] - drawn.xs()[0] <= 8f;
|
||||
}
|
||||
ReachStyle[] style = ReachShaper.styles(drawn.grade(), new boolean[zone.length], zone, narrow.waterfallMinimumDrop(), SEA_LEVEL);
|
||||
ReachStyle[] style = ReachShaper.styles(drawn.grade(), new boolean[zone.length], zone, narrow.waterfallMinimumDrop(), SEA_LEVEL, narrow.stepHeight());
|
||||
assertEquals("the last outlet zone point steps down one block, shown as two", ReachStyle.CASCADE, style[4]);
|
||||
assertTrue("the step lies at the end of the outlet zone", zone[4] && !zone[5]);
|
||||
Reach outlet = new Reach(drawn.id(), narrow, drawn.downstreamId(), drawn.xs(), drawn.zs(), drawn.grade(), drawn.halfWidth(), drawn.depth(),
|
||||
@@ -1027,7 +1027,7 @@ public class ChunkWaterRasterTest {
|
||||
|
||||
@Test
|
||||
public void crossWindowJunctionDropsSpreadOnTiersWithoutCascades() {
|
||||
HydrologyTier gentle = new HydrologyTier("stream", 0f, 2f, 2f, 0f, 0.5f, 1, false, 6, 4, IrisBankStyle.SMOOTH,
|
||||
HydrologyTier gentle = new HydrologyTier("stream", 0f, 2f, 2f, 0f, 0.5f, 1, false, 6, 2, 4, IrisBankStyle.SMOOTH,
|
||||
new HydrologyTier.Estuary(48, 2.5f), new HydrologyTier.Delta(0, 35f, 64), new IrisHydrologyMaterials(), "water", List.of());
|
||||
HydrologyTier wide = tier("river", 3f, 0.5f, 4, IrisBankStyle.SMOOTH);
|
||||
Reach low = line(262L, wide, 0L, 504f, 200f, 600f, 200f, (x, z) -> 62);
|
||||
@@ -2004,7 +2004,7 @@ public class ChunkWaterRasterTest {
|
||||
|
||||
private int straightHead(double x, double z) {
|
||||
segments.nearest(x, z, ReachSegments.Scope.CHANNEL, straight);
|
||||
return straight.channel.reach == null ? Integer.MIN_VALUE : WaterHeads.snap(straight.channel.grade(), SEA_LEVEL);
|
||||
return straight.channel.reach == null ? Integer.MIN_VALUE : WaterHeads.snap(straight.channel.grade(), SEA_LEVEL, straight.channel.reach.tier().stepHeight());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2133,7 +2133,7 @@ public class ChunkWaterRasterTest {
|
||||
private static float firstSeaLevelHead(HydrologySettings settings) {
|
||||
Reach river = DeltaCoast.river(DeltaCoast.shape(settings, 0, 0, List.of(), DeltaCoast.NO_NEIGHBOUR, DeltaCoast.SEED, DeltaCoast::cliffBacked), DeltaCoast.ROW);
|
||||
int point = 0;
|
||||
while (WaterHeads.snap(river.grade()[point], SEA_LEVEL) > SEA_LEVEL) {
|
||||
while (WaterHeads.snap(river.grade()[point], SEA_LEVEL, river.tier().stepHeight()) > SEA_LEVEL) {
|
||||
point++;
|
||||
}
|
||||
return river.xs()[point];
|
||||
@@ -2286,7 +2286,7 @@ public class ChunkWaterRasterTest {
|
||||
}
|
||||
|
||||
private static HydrologyTier lavaTier() {
|
||||
return new HydrologyTier("lava", 0f, 1.5f, 1.5f, 0f, 0.5f, 1, true, 6, 8, IrisBankStyle.SMOOTH,
|
||||
return new HydrologyTier("lava", 0f, 1.5f, 1.5f, 0f, 0.5f, 1, true, 6, 2, 8, IrisBankStyle.SMOOTH,
|
||||
new HydrologyTier.Estuary(48, 2.5f), new HydrologyTier.Delta(0, 35f, 64), new IrisHydrologyMaterials(), "lava", List.of());
|
||||
}
|
||||
|
||||
@@ -2385,8 +2385,49 @@ public class ChunkWaterRasterTest {
|
||||
return HydrologySettings.compile(config, SEED, SEA_LEVEL, MIN_Y, MAX_Y);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void oneBlockStepsReachTheWorld() {
|
||||
Reach fine = stepped(301L, steppedTier(1));
|
||||
Reach coarse = stepped(301L, steppedTier(2));
|
||||
for (long seed = 1L; seed <= 24L; seed++) {
|
||||
String label = "seed " + seed + ": ";
|
||||
Scene scene = new Scene(seededSettings(seed), (x, z) -> 110).reach(fine);
|
||||
Scene even = new Scene(seededSettings(seed), (x, z) -> 110).reach(coarse);
|
||||
int oneBlockSteps = 0;
|
||||
for (int x = -39; x < 32; x++) {
|
||||
int planned = 100 - Math.floorDiv(x + 40, 8);
|
||||
if (Math.floorMod(x + 40, 8) >= 2 && Math.floorMod(x + 40, 8) <= 5) {
|
||||
assertEquals(label + "planned level at " + x, planned, scene.head(x, 8));
|
||||
assertEquals(label + "the 2-block tier snaps at " + x, planned - Math.floorMod(planned - SEA_LEVEL, 2), even.head(x, 8));
|
||||
}
|
||||
oneBlockSteps += scene.head(x - 1, 8) - scene.head(x, 8) == 1 ? 1 : 0;
|
||||
}
|
||||
assertTrue(label + "one-block steps " + oneBlockSteps, oneBlockSteps >= 9);
|
||||
assertEquals(label + "the upper side of a riffle sits one block deep", scene.head(-1, 8) - 1, scene.terrain(-1, 8));
|
||||
int fallCells = 0;
|
||||
for (int x = 34; x <= 48; x++) {
|
||||
for (int z = 3; z <= 13; z++) {
|
||||
fallCells += scene.role(x, z) == WaterRole.WATERFALL ? 1 : 0;
|
||||
}
|
||||
}
|
||||
assertTrue(label + "the fall keeps its role", fallCells > 0);
|
||||
assertEquals(label + "the fall lands on its level", 83, scene.head(44, 12));
|
||||
assertTrue(label + "the fall still has a plunge pool: bed " + scene.terrain(44, 8), scene.terrain(44, 8) <= 83 - 3);
|
||||
assertEquals(label + "leaks", 0, scene.leaks(-50, -10, 130, 30));
|
||||
}
|
||||
}
|
||||
|
||||
private static HydrologyTier steppedTier(int stepHeight) {
|
||||
return new HydrologyTier("stream", 0f, 5f, 5f, 0f, 0.8f, 1, false, 6, stepHeight, 4, IrisBankStyle.SMOOTH,
|
||||
new HydrologyTier.Estuary(48, 2.5f), new HydrologyTier.Delta(0, 35f, 64), new IrisHydrologyMaterials(), "water", List.of());
|
||||
}
|
||||
|
||||
private static Reach stepped(long id, HydrologyTier tier) {
|
||||
return line(id, tier, 0L, -48f, 8f, 120f, 8f, (x, z) -> x < 40f ? 100 - Math.floorDiv((int) Math.floor(x) + 40, 8) : 83);
|
||||
}
|
||||
|
||||
private static HydrologyTier tier(String name, float halfWidth, float depthRatio, int bankBand, IrisBankStyle style) {
|
||||
return new HydrologyTier(name, 0f, halfWidth, halfWidth, 0f, depthRatio, 1, true, 6, bankBand, style,
|
||||
return new HydrologyTier(name, 0f, halfWidth, halfWidth, 0f, depthRatio, 1, true, 6, 2, bankBand, style,
|
||||
new HydrologyTier.Estuary(48, 2.5f), new HydrologyTier.Delta(0, 35f, 64), new IrisHydrologyMaterials(), "water", List.of());
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -197,7 +197,7 @@ public class PondChannelSettlementTest {
|
||||
depth[point] = 2f;
|
||||
styles[point] = ReachStyle.RUN;
|
||||
}
|
||||
HydrologyTier tier = new HydrologyTier("river", 0f, 40f, 40f, 0f, 0.5f, 2, true, 6, 0, IrisBankStyle.SMOOTH,
|
||||
HydrologyTier tier = new HydrologyTier("river", 0f, 40f, 40f, 0f, 0.5f, 2, true, 6, 2, 0, IrisBankStyle.SMOOTH,
|
||||
new HydrologyTier.Estuary(48, 2.5f), new HydrologyTier.Delta(0, 35f, 64), null, "water", List.of());
|
||||
return new Reach(id, tier, 0L, xs, zs, grade, widths, depth, styles, 1000f);
|
||||
}
|
||||
@@ -252,7 +252,7 @@ public class PondChannelSettlementTest {
|
||||
}
|
||||
|
||||
private static Reach line(long id, int x0, int z0, int x1, int z1, float width, int first, int last) {
|
||||
HydrologyTier tier = new HydrologyTier("river", 0f, width, width, 0f, 0.5f, 2, true, 6, 0, IrisBankStyle.SMOOTH,
|
||||
HydrologyTier tier = new HydrologyTier("river", 0f, width, width, 0f, 0.5f, 2, true, 6, 2, 0, IrisBankStyle.SMOOTH,
|
||||
new HydrologyTier.Estuary(48, 2.5f), new HydrologyTier.Delta(0, 35f, 64), null, "water", List.of());
|
||||
float[] widths = new float[]{width, width};
|
||||
float[] depth = new float[]{2f, 2f};
|
||||
|
||||
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertTrue;
|
||||
public class ReachIndexTest {
|
||||
private static final WindowKey WINDOW = new WindowKey(0, 0);
|
||||
private static final int BANK_BAND = 4;
|
||||
private static final HydrologyTier TIER = new HydrologyTier("test", 0f, 1f, 4f, 1f, 0.4f, 1, true, 6, BANK_BAND, IrisBankStyle.SMOOTH,
|
||||
private static final HydrologyTier TIER = new HydrologyTier("test", 0f, 1f, 4f, 1f, 0.4f, 1, true, 6, 2, BANK_BAND, IrisBankStyle.SMOOTH,
|
||||
new HydrologyTier.Estuary(48, 2.5f), new HydrologyTier.Delta(0, 35f, 64), new IrisHydrologyMaterials(), "water", List.of());
|
||||
|
||||
@Test
|
||||
@@ -186,7 +186,7 @@ public class ReachIndexTest {
|
||||
}
|
||||
|
||||
private static HydrologyTier tier(String name, int bankBand) {
|
||||
return new HydrologyTier(name, 0f, 0.5f, 4f, 1f, 0.4f, 1, true, 6, bankBand, IrisBankStyle.SMOOTH,
|
||||
return new HydrologyTier(name, 0f, 0.5f, 4f, 1f, 0.4f, 1, true, 6, 2, bankBand, IrisBankStyle.SMOOTH,
|
||||
new HydrologyTier.Estuary(48, 2.5f), new HydrologyTier.Delta(0, 35f, 64), new IrisHydrologyMaterials(),
|
||||
"water", List.of());
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ReachSegmentsTest {
|
||||
private static final HydrologyTier TIER = new HydrologyTier("test", 0f, 1f, 4f, 1f, 0.4f, 1, true, 6, 4, IrisBankStyle.SMOOTH,
|
||||
private static final HydrologyTier TIER = new HydrologyTier("test", 0f, 1f, 4f, 1f, 0.4f, 1, true, 6, 2, 4, IrisBankStyle.SMOOTH,
|
||||
new HydrologyTier.Estuary(48, 2.5f), new HydrologyTier.Delta(0, 35f, 64), new IrisHydrologyMaterials(), "water", List.of());
|
||||
|
||||
@Test
|
||||
|
||||
+11
-11
@@ -624,7 +624,7 @@ public class ReachShaperTest {
|
||||
boolean[] noZone = new boolean[count];
|
||||
Arrays.fill(grade, 0, 3, 90);
|
||||
Arrays.fill(grade, 3, count, 78);
|
||||
ReachStyle[] style = ReachShaper.styles(grade, noOcean, noZone, 6, SEA_LEVEL);
|
||||
ReachStyle[] style = ReachShaper.styles(grade, noOcean, noZone, 6, SEA_LEVEL, 2);
|
||||
float[] flare = ReachShaper.plungeFlare(grade, style, noOcean, distance, 0f, 6);
|
||||
assertEquals(ReachShaper.PLUNGE_FLARE, flare[3], 0f);
|
||||
assertEquals("nothing above the foot", 0f, flare[2], 0f);
|
||||
@@ -637,14 +637,14 @@ public class ReachShaperTest {
|
||||
int[] atFirst = new int[count];
|
||||
Arrays.fill(atFirst, 1, count, -12);
|
||||
atFirst[0] = 0;
|
||||
assertEquals("index 0 never flares", 0f, ReachShaper.plungeFlare(atFirst, ReachShaper.styles(atFirst, noOcean, noZone, 6, -40), noOcean, distance, 0f, 6)[0], 0f);
|
||||
assertEquals("index 0 never flares", 0f, ReachShaper.plungeFlare(atFirst, ReachShaper.styles(atFirst, noOcean, noZone, 6, -40, 2), noOcean, distance, 0f, 6)[0], 0f);
|
||||
int[] atLast = new int[count];
|
||||
atLast[count - 1] = -12;
|
||||
assertEquals("the last index never flares", 0f, ReachShaper.plungeFlare(atLast, ReachShaper.styles(atLast, noOcean, noZone, 6, -40), noOcean, distance, 0f, 6)[count - 1], 0f);
|
||||
assertEquals("the last index never flares", 0f, ReachShaper.plungeFlare(atLast, ReachShaper.styles(atLast, noOcean, noZone, 6, -40, 2), noOcean, distance, 0f, 6)[count - 1], 0f);
|
||||
|
||||
boolean[] ocean = new boolean[count];
|
||||
Arrays.fill(ocean, 3, count, true);
|
||||
ReachStyle[] mouth = ReachShaper.styles(grade, ocean, noZone, 6, SEA_LEVEL);
|
||||
ReachStyle[] mouth = ReachShaper.styles(grade, ocean, noZone, 6, SEA_LEVEL, 2);
|
||||
float[] atSea = ReachShaper.plungeFlare(grade, mouth, ocean, distance, 0f, 6);
|
||||
for (int point = 0; point < count; point++) {
|
||||
assertEquals("a fall into the sea flares nothing at " + point, 0f, atSea[point], 0f);
|
||||
@@ -2120,7 +2120,7 @@ public class ReachShaperTest {
|
||||
|
||||
int[] grade = {62, 62, 62, 40, 40};
|
||||
boolean[] ocean = {false, false, false, true, true};
|
||||
ReachStyle[] styles = ReachShaper.styles(grade, ocean, new boolean[grade.length], 6, SEA_LEVEL);
|
||||
ReachStyle[] styles = ReachShaper.styles(grade, ocean, new boolean[grade.length], 6, SEA_LEVEL, 2);
|
||||
assertEquals(List.of(ReachStyle.RUN, ReachStyle.RUN, ReachStyle.WATERFALL, ReachStyle.MOUTH, ReachStyle.MOUTH), List.of(styles));
|
||||
}
|
||||
|
||||
@@ -2131,17 +2131,17 @@ public class ReachShaperTest {
|
||||
boolean[] held = {true, true, true, false, false};
|
||||
assertEquals("a one-block step off a held lip that the even head snap shows as two blocks",
|
||||
List.of(ReachStyle.POND_OUTLET, ReachStyle.POND_OUTLET, ReachStyle.POND_OUTLET, ReachStyle.CASCADE, ReachStyle.RUN),
|
||||
List.of(ReachShaper.styles(grade, ocean, held, 6, SEA_LEVEL)));
|
||||
assertEquals("the same step hidden by the head snap", ReachStyle.RIFFLE, ReachShaper.styles(grade, ocean, held, 6, SEA_LEVEL + 1)[3]);
|
||||
List.of(ReachShaper.styles(grade, ocean, held, 6, SEA_LEVEL, 2)));
|
||||
assertEquals("the same step hidden by the head snap", ReachStyle.RIFFLE, ReachShaper.styles(grade, ocean, held, 6, SEA_LEVEL + 1, 2)[3]);
|
||||
assertEquals("a one-block step that leaves no held lip", ReachStyle.RIFFLE,
|
||||
ReachShaper.styles(grade, ocean, new boolean[grade.length], 6, SEA_LEVEL)[3]);
|
||||
ReachShaper.styles(grade, ocean, new boolean[grade.length], 6, SEA_LEVEL, 2)[3]);
|
||||
int[] zoned = {78, 78, 77, 77, 77};
|
||||
boolean[] zone = {true, true, true, true, false};
|
||||
assertEquals("a one-block step inside an outlet zone that the head snap shows as two blocks",
|
||||
List.of(ReachStyle.POND_OUTLET, ReachStyle.POND_OUTLET, ReachStyle.CASCADE, ReachStyle.POND_OUTLET, ReachStyle.RUN),
|
||||
List.of(ReachShaper.styles(zoned, ocean, zone, 6, SEA_LEVEL)));
|
||||
List.of(ReachShaper.styles(zoned, ocean, zone, 6, SEA_LEVEL, 2)));
|
||||
assertEquals("the same step inside the zone hidden by the head snap", ReachStyle.POND_OUTLET,
|
||||
ReachShaper.styles(zoned, ocean, zone, 6, SEA_LEVEL + 1)[2]);
|
||||
ReachShaper.styles(zoned, ocean, zone, 6, SEA_LEVEL + 1, 2)[2]);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -2899,7 +2899,7 @@ public class ReachShaperTest {
|
||||
|
||||
private static HydrologyTier withSteps(HydrologyTier tier, boolean cascades, int waterfallMinimumDrop) {
|
||||
return new HydrologyTier(tier.name(), tier.minCatchment(), tier.minHalfWidth(), tier.maxHalfWidth(), tier.widthFactor(), tier.depthRatio(),
|
||||
tier.inset(), cascades, waterfallMinimumDrop, tier.bankBand(), tier.bankStyle(), tier.estuary(), tier.delta(), tier.materials(),
|
||||
tier.inset(), cascades, waterfallMinimumDrop, 2, tier.bankBand(), tier.bankStyle(), tier.estuary(), tier.delta(), tier.materials(),
|
||||
tier.fluid(), tier.decorators());
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -351,7 +351,7 @@ public class IrisComplexHeightStreamTest {
|
||||
IrisHydrologyMaterials ponds = RASTER_SETTINGS.ponds().materials();
|
||||
ChunkWaterRaster raster = mock(ChunkWaterRaster.class);
|
||||
IrisHydrologyMaterials tierMaterials = new IrisHydrologyMaterials();
|
||||
HydrologyTier tier = new HydrologyTier("river", 0f, 1f, 2f, 1f, 0.4f, 1, true, 6, 0, IrisBankStyle.SMOOTH,
|
||||
HydrologyTier tier = new HydrologyTier("river", 0f, 1f, 2f, 1f, 0.4f, 1, true, 6, 2, 0, IrisBankStyle.SMOOTH,
|
||||
new HydrologyTier.Estuary(48, 2.5f), new HydrologyTier.Delta(0, 35f, 64), tierMaterials, "water", List.of());
|
||||
when(raster.waterHead(anyInt(), anyInt())).thenReturn(Integer.MIN_VALUE);
|
||||
when(raster.tier(5, 9)).thenReturn(tier);
|
||||
|
||||
@@ -84,7 +84,7 @@ public class SchemaBuilderIdentityTest {
|
||||
@ClassRule
|
||||
public static final PlatformLeakGuard PLATFORM_GUARD = PlatformLeakGuard.clean();
|
||||
|
||||
private static final String EXPECTED_SCHEMA_DIGEST = "c87139f807de29aa444923b6b0a1f85dc8de882ea8cf13ea3818fbdaeb352ae6";
|
||||
private static final String EXPECTED_SCHEMA_DIGEST = "addfddb3462b79563ecc3ba52a3000d36d2fc02e63966ae2e1bdf42de90130b5";
|
||||
|
||||
private static final List<Class<?>> SCHEMA_ROOTS = List.of(
|
||||
IrisDimension.class,
|
||||
|
||||
@@ -81,7 +81,7 @@ public final class WaterScene {
|
||||
}
|
||||
|
||||
public static HydrologyTier tier(String name, float halfWidth, float depthRatio) {
|
||||
return new HydrologyTier(name, 0f, halfWidth, halfWidth, 0f, depthRatio, 1, true, 6, 0, IrisBankStyle.SMOOTH,
|
||||
return new HydrologyTier(name, 0f, halfWidth, halfWidth, 0f, depthRatio, 1, true, 6, 2, 0, IrisBankStyle.SMOOTH,
|
||||
new HydrologyTier.Estuary(48, 2.5f), new HydrologyTier.Delta(0, 35f, 64), new IrisHydrologyMaterials(), "water", List.of());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user