mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 09:15:27 +00:00
Rename hydrology config fields
- Rename climateDrawdown to dryDrawdown - Rename minimumHeadKeep to minHeadKeep - Rename minimumCliffHeight to minCliffHeight - Rename waterfallMinimumDrop to waterfallMinDrop - Repin the schema digest for the new names
This commit is contained in:
29 files changed
+91
-91
No files matched your search
+6
-6
@@ -16,24 +16,24 @@ public class IrisHydrologyDefaultsTest {
|
||||
private static final String PLAN_JSON = """
|
||||
{
|
||||
"enabled": false,
|
||||
"drainage": { "fillEpsilon": 0.001, "breachDepth": 24, "wetnessThinning": true, "minimumHeadKeep": 0.25, "saturationCatchment": 4194304 },
|
||||
"drainage": { "fillEpsilon": 0.001, "breachDepth": 24, "wetnessThinning": true, "minHeadKeep": 0.25, "saturationCatchment": 4194304 },
|
||||
"tiers": [
|
||||
{ "name": "stream", "minCatchment": 1500, "halfWidth": [0.5, 2], "widthFactor": 1.0, "depthRatio": 0.4, "inset": 1, "cascades": true, "waterfallMinimumDrop": 6, "bankBand": 0, "bankStyle": "SMOOTH", "estuary": { "length": 48, "flare": 2.5 }, "delta": { "channels": 0, "spreadDegrees": 35, "length": 64 }, "materials": {}, "fluid": "water" },
|
||||
{ "name": "river", "minCatchment": 20000, "halfWidth": [2, 8], "widthFactor": 1.0, "depthRatio": 0.45, "inset": 2, "cascades": true, "waterfallMinimumDrop": 6, "bankBand": 32, "bankStyle": "SMOOTH", "estuary": { "length": 48, "flare": 2.5 }, "delta": { "channels": 0, "spreadDegrees": 35, "length": 64 }, "materials": {}, "fluid": "water" },
|
||||
{ "name": "major", "minCatchment": 320000, "halfWidth": [8, 16], "widthFactor": 1.0, "depthRatio": 0.5, "inset": 3, "cascades": true, "waterfallMinimumDrop": 6, "bankBand": 48, "bankStyle": "SMOOTH", "estuary": { "length": 48, "flare": 2.5 }, "delta": { "channels": 0, "spreadDegrees": 35, "length": 64 }, "materials": {}, "fluid": "water" }
|
||||
{ "name": "stream", "minCatchment": 1500, "halfWidth": [0.5, 2], "widthFactor": 1.0, "depthRatio": 0.4, "inset": 1, "cascades": true, "waterfallMinDrop": 6, "bankBand": 0, "bankStyle": "SMOOTH", "estuary": { "length": 48, "flare": 2.5 }, "delta": { "channels": 0, "spreadDegrees": 35, "length": 64 }, "materials": {}, "fluid": "water" },
|
||||
{ "name": "river", "minCatchment": 20000, "halfWidth": [2, 8], "widthFactor": 1.0, "depthRatio": 0.45, "inset": 2, "cascades": true, "waterfallMinDrop": 6, "bankBand": 32, "bankStyle": "SMOOTH", "estuary": { "length": 48, "flare": 2.5 }, "delta": { "channels": 0, "spreadDegrees": 35, "length": 64 }, "materials": {}, "fluid": "water" },
|
||||
{ "name": "major", "minCatchment": 320000, "halfWidth": [8, 16], "widthFactor": 1.0, "depthRatio": 0.5, "inset": 3, "cascades": true, "waterfallMinDrop": 6, "bankBand": 48, "bankStyle": "SMOOTH", "estuary": { "length": 48, "flare": 2.5 }, "delta": { "channels": 0, "spreadDegrees": 35, "length": 64 }, "materials": {}, "fluid": "water" }
|
||||
],
|
||||
"ponds": {
|
||||
"natural": { "enabled": true, "keep": 1.0, "minArea": 256, "maxArea": 65536, "minDepth": 2 },
|
||||
"seeded": { "enabled": true, "density": 4.0, "radius": [6, 24], "depth": [3, 8], "maxSlope": 0.6, "alongChannels": true, "channelSpacing": [96, 256] },
|
||||
"dams": { "enabled": false, "maxRaise": 4 },
|
||||
"freeboard": [1, 3], "climateDrawdown": 6,
|
||||
"freeboard": [1, 3], "dryDrawdown": 6,
|
||||
"shore": { "roundness": 0.5, "shelf": 6, "taper": 14, "maxDepth": 8 },
|
||||
"materials": {}, "fluid": "water"
|
||||
},
|
||||
"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, "minimumCliffHeight": 8, "length": [64, 256], "halfWidth": [2, 5], "depth": [2, 5], "headroom": [4, 10], "roofClearance": 6, "chamberRadius": [6, 12] },
|
||||
"seaInlets": { "enabled": true, "spacing": 192, "minCliffHeight": 8, "length": [64, 256], "halfWidth": [2, 5], "depth": [2, 5], "headroom": [4, 10], "roofClearance": 6, "chamberRadius": [6, 12] },
|
||||
"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" } ] } } ],
|
||||
|
||||
+1
-1
@@ -263,7 +263,7 @@ public class IrisHydrologyTerrainSourceTest {
|
||||
Pond swamp = floorPond(fixture, settings, column);
|
||||
spires.setHydrologyPolicy(new IrisHydrologyPolicy().setPondDensity(16D).setWetness(new IrisHydrologyWetness().setMin(1D)));
|
||||
Pond kept = floorPond(fixture, settings, column);
|
||||
int drawdown = settings.ponds().climateDrawdown();
|
||||
int drawdown = settings.ponds().dryDrawdown();
|
||||
assertEquals((int) Math.floor(kept.spillHeight()) - 1, kept.level());
|
||||
assertEquals(kept.level() - Math.round(drawdown * 0.3f), swamp.level());
|
||||
assertEquals(kept.level() - Math.round(drawdown * 0.85f), dry.level());
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ public class ConfluenceIncisionTest {
|
||||
}
|
||||
}
|
||||
assertTrue(major + " is cut " + cut + " into the wall", cut <= MAX_WALL_CUT);
|
||||
double tallestFall = WALL_HEIGHT / 2D + major.tier().waterfallMinimumDrop();
|
||||
double tallestFall = WALL_HEIGHT / 2D + major.tier().waterfallMinDrop();
|
||||
assertTrue(major + " falls " + largest + " blocks at once down a " + WALL_HEIGHT + "-block wall", largest <= tallestFall);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,9 +103,9 @@ final class PlannedScene {
|
||||
new IrisHydrologyTier().setName("river").setMinCatchment(5000D).setHalfWidth(new KList<>(2.5D, 9D)).setWidthFactor(1.2D)
|
||||
.setDepthRatio(0.45D).setInset(2).setBankBand(32),
|
||||
new IrisHydrologyTier().setName("major").setMinCatchment(200000D).setHalfWidth(new KList<>(9D, 18D)).setWidthFactor(1.2D)
|
||||
.setDepthRatio(0.5D).setInset(3).setBankBand(48).setWaterfallMinimumDrop(8)));
|
||||
.setDepthRatio(0.5D).setInset(3).setBankBand(48).setWaterfallMinDrop(8)));
|
||||
config.getPonds().setFreeboard(new KList<>(1, 2));
|
||||
config.getPonds().setClimateDrawdown(3);
|
||||
config.getPonds().setDryDrawdown(3);
|
||||
config.getPonds().getSeeded().setDensity(10D).setRadius(new KList<>(6, 22)).setMaxSlope(0.7D).setChannelSpacing(new KList<>(80, 192));
|
||||
config.getPonds().getShore().setRoundness(0.5D).setShelf(6).setTaper(14).setMaxDepth(8);
|
||||
return config;
|
||||
|
||||
@@ -308,7 +308,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().waterfallMinDrop(), seaLevel);
|
||||
return new Reach(reach.id(), reach.tier(), reach.downstreamId(), reach.xs(), reach.zs(), reach.grade(), reach.halfWidth(), reach.depth(),
|
||||
style, reach.catchment());
|
||||
}
|
||||
@@ -334,7 +334,7 @@ public class PlannedSceneTest {
|
||||
halfWidths[point] = halfWidth;
|
||||
depths[point] = tier.depth(halfWidth);
|
||||
int drop = point == 0 ? 0 : grades[point - 1] - grades[point];
|
||||
styles[point] = drop >= tier.waterfallMinimumDrop() ? ReachStyle.WATERFALL
|
||||
styles[point] = drop >= tier.waterfallMinDrop() ? ReachStyle.WATERFALL
|
||||
: drop >= 2 ? ReachStyle.CASCADE : drop == 1 ? ReachStyle.RIFFLE : ReachStyle.RUN;
|
||||
}
|
||||
return new Reach(id, tier, downstreamId, xs, zs, grades, halfWidths, depths, styles, 1000f);
|
||||
|
||||
@@ -1153,7 +1153,7 @@ public class WindowPlannerTest {
|
||||
int last = feeder.xs().length - 1;
|
||||
int drop = feeder.grade()[last] - downstream.grade()[0];
|
||||
assertTrue(feeder + " meets " + downstream + " across the window line with a drop of " + drop,
|
||||
drop >= 0 && drop < downstream.tier().waterfallMinimumDrop());
|
||||
drop >= 0 && drop < downstream.tier().waterfallMinDrop());
|
||||
}
|
||||
assertTrue("reaches near the window line " + westOwned.size() + " + " + eastOwned.size(), westOwned.size() + eastOwned.size() >= 3);
|
||||
assertTrue("reach links between the two windows' plans " + links, links >= 1);
|
||||
|
||||
+3
-3
@@ -817,7 +817,7 @@ public class ChunkWaterRasterTest {
|
||||
public void clampedSeamDropsAreStyledAsFalls() {
|
||||
HydrologyTier narrow = tier("river", 2f, 0.5f, 4, IrisBankStyle.SMOOTH);
|
||||
HydrologyTier wide = tier("river", 3f, 0.5f, 4, IrisBankStyle.SMOOTH);
|
||||
assertEquals(6, narrow.waterfallMinimumDrop());
|
||||
assertEquals(6, narrow.waterfallMinDrop());
|
||||
Reach low = line(232L, wide, 0L, 504f, 200f, 600f, 200f, (x, z) -> 62);
|
||||
Reach hanging = line(231L, narrow, low.id(), 440f, 200f, 504f, 200f, (x, z) -> 70);
|
||||
Scene falls = new Scene(settings(new IrisHydrology()), (x, z) -> 90).reach(hanging).reach(low);
|
||||
@@ -922,7 +922,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.waterfallMinDrop(), SEA_LEVEL);
|
||||
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(),
|
||||
@@ -1523,7 +1523,7 @@ public class ChunkWaterRasterTest {
|
||||
halfWidth[point] = tier.minHalfWidth();
|
||||
depth[point] = tier.depth(tier.minHalfWidth());
|
||||
int drop = point == 0 ? 0 : grades[point - 1] - grades[point];
|
||||
style[point] = drop >= tier.waterfallMinimumDrop() ? ReachStyle.WATERFALL
|
||||
style[point] = drop >= tier.waterfallMinDrop() ? ReachStyle.WATERFALL
|
||||
: drop >= 2 ? ReachStyle.CASCADE : drop == 1 ? ReachStyle.RIFFLE : ReachStyle.RUN;
|
||||
}
|
||||
return new Reach(id, tier, downstreamId, xs, zs, grades, halfWidth, depth, style, 1000f);
|
||||
|
||||
@@ -451,7 +451,7 @@ public class PondPlannerTest {
|
||||
Pond dry = single(plan(settings, new Terrain(terrain, 0f, ALLOW_ALL, null, MIN_Y, MAX_Y), 0, 0, 64, 64, null, List.of()));
|
||||
Pond damp = single(plan(settings, new Terrain(terrain, 0.5f, ALLOW_ALL, null, MIN_Y, MAX_Y), 0, 0, 64, 64, null, List.of()));
|
||||
assertEquals(wet.id(), dry.id());
|
||||
assertEquals(settings.ponds().climateDrawdown(), wet.level() - dry.level());
|
||||
assertEquals(settings.ponds().dryDrawdown(), wet.level() - dry.level());
|
||||
assertTrue(damp.level() < wet.level() && damp.level() > dry.level());
|
||||
assertContained(dry, terrain);
|
||||
}
|
||||
@@ -460,7 +460,7 @@ public class PondPlannerTest {
|
||||
public void drawdownFollowsClimateDryness() {
|
||||
HydrologySettings settings = settings(PondPlannerTest::naturalOnly, MIN_Y, MAX_Y);
|
||||
DoubleBinaryOperator terrain = bowl(256, 256, 60, 100, 12, 0.1);
|
||||
int drawdown = settings.ponds().climateDrawdown();
|
||||
int drawdown = settings.ponds().dryDrawdown();
|
||||
Pond full = single(plan(settings, new Terrain(terrain, 1f, ALLOW_ALL, null, MIN_Y, MAX_Y), 0, 0, 64, 64, null, List.of()));
|
||||
Pond wetZone = single(plan(settings, new Terrain(terrain, 0.5f, ALLOW_ALL, null, MIN_Y, MAX_Y).climateZoned((x, z) -> 1D),
|
||||
0, 0, 64, 64, null, List.of()));
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ReachShaperTest {
|
||||
for (Reach reach : spread.reaches()) {
|
||||
Reach twin = steppedById.get(reach.id());
|
||||
assertNotNull(twin);
|
||||
int fall = reach.tier().waterfallMinimumDrop();
|
||||
int fall = reach.tier().waterfallMinDrop();
|
||||
int junction = twin.downstreamId() == 0L ? Integer.MIN_VALUE : twin.grade()[twin.grade().length - 1];
|
||||
assertTrue("trial " + trial + " " + reach + " gained a waterfall",
|
||||
dropsAbove(reach, junction, fall, Integer.MAX_VALUE) <= dropsAbove(twin, junction, fall, Integer.MAX_VALUE));
|
||||
@@ -230,7 +230,7 @@ public class ReachShaperTest {
|
||||
public void dropAtWaterfallMinimumBecomesWaterfall() {
|
||||
HydrologySettings cascading = settings(config -> {
|
||||
});
|
||||
int minimum = cascading.tiers().get(1).waterfallMinimumDrop();
|
||||
int minimum = cascading.tiers().get(1).waterfallMinDrop();
|
||||
List<Drop> waterfall = drops(cascading, steppedValley(minimum));
|
||||
assertEquals("drops " + waterfall, 1, waterfall.size());
|
||||
assertEquals(minimum, waterfall.get(0).size());
|
||||
@@ -293,9 +293,9 @@ public class ReachShaperTest {
|
||||
int[] grade = steep.grade;
|
||||
for (int index = 1; index < grade.length; index++) {
|
||||
int drop = grade[index - 1] - grade[index];
|
||||
assertTrue(Arrays.toString(grade), drop >= 0 && drop < tier.waterfallMinimumDrop());
|
||||
assertTrue(Arrays.toString(grade), drop >= 0 && drop < tier.waterfallMinDrop());
|
||||
}
|
||||
assertTrue(Arrays.toString(grade), grade[0] > (int) ground[0] - tier.inset() - tier.waterfallMinimumDrop());
|
||||
assertTrue(Arrays.toString(grade), grade[0] > (int) ground[0] - tier.inset() - tier.waterfallMinDrop());
|
||||
assertEquals((int) ground[ground.length - 1] - tier.inset(), grade[grade.length - 1]);
|
||||
}
|
||||
|
||||
@@ -1570,7 +1570,7 @@ public class ReachShaperTest {
|
||||
for (int index = 1; index <= entry && fall < 0; index++) {
|
||||
fall = reach.grade()[index] == SEA_LEVEL ? index : -1;
|
||||
}
|
||||
if (reach.grade()[fall - 1] - SEA_LEVEL >= reach.tier().waterfallMinimumDrop()) {
|
||||
if (reach.grade()[fall - 1] - SEA_LEVEL >= reach.tier().waterfallMinDrop()) {
|
||||
falls++;
|
||||
int lip = fall == entry ? entry - 1 : fall;
|
||||
assertEquals(reach.toString(), ReachStyle.WATERFALL, reach.style()[lip]);
|
||||
|
||||
@@ -514,16 +514,16 @@ public class PackHydrologyValidatorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rejectsWaterfallMinimumDropBelowTwo() throws Exception {
|
||||
public void rejectsWaterfallMinDropBelowTwo() throws Exception {
|
||||
File pack = pack(dimension("""
|
||||
{"enabled": true, "tiers": [{"name": "stream", "halfWidth": [0.5, 2], "bankBand": 0},
|
||||
{"name": "river", "minCatchment": 20000, "halfWidth": [2, 8], "bankBand": 32, "waterfallMinimumDrop": 1}]}
|
||||
{"name": "river", "minCatchment": 20000, "halfWidth": [2, 8], "bankBand": 32, "waterfallMinDrop": 1}]}
|
||||
""", ""));
|
||||
write(pack, "dimensions/edge.json", dimension("""
|
||||
{"enabled": true, "tiers": [{"name": "stream", "halfWidth": [0.5, 2], "bankBand": 0, "waterfallMinimumDrop": 2}]}
|
||||
{"enabled": true, "tiers": [{"name": "stream", "halfWidth": [0.5, 2], "bankBand": 0, "waterfallMinDrop": 2}]}
|
||||
""", ""));
|
||||
|
||||
assertEquals(List.of("Dimension 'main'.hydrology does not compile: Hydrology tiers[1].waterfallMinimumDrop must be at least 2, got 1"),
|
||||
assertEquals(List.of("Dimension 'main'.hydrology does not compile: Hydrology tiers[1].waterfallMinDrop must be at least 2, got 1"),
|
||||
validate(pack).errors());
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class SchemaBuilderIdentityTest {
|
||||
@ClassRule
|
||||
public static final PlatformLeakGuard PLATFORM_GUARD = PlatformLeakGuard.clean();
|
||||
|
||||
private static final String EXPECTED_SCHEMA_DIGEST = "3377c4bd7994ef223bbb054391c191e6dc202475232d19c5c3fe4f43402ffed1";
|
||||
private static final String EXPECTED_SCHEMA_DIGEST = "7eaf3ddcf305811c453a61368a9ae886cedb1ce47d4ca6dc53953ab8f26f5a77";
|
||||
|
||||
private static final List<Class<?>> SCHEMA_ROOTS = List.of(
|
||||
IrisDimension.class,
|
||||
|
||||
@@ -80,8 +80,8 @@ public class IrisRiverSchemaTest {
|
||||
assertTrue(section, properties.getJSONObject(section).has("$ref"));
|
||||
}
|
||||
assertEquals("array", tier.getJSONObject("halfWidth").getString("type"));
|
||||
assertEquals(2, tier.getJSONObject("waterfallMinimumDrop").getInt("minimum"));
|
||||
assertEquals(64, tier.getJSONObject("waterfallMinimumDrop").getInt("maximum"));
|
||||
assertEquals(2, tier.getJSONObject("waterfallMinDrop").getInt("minimum"));
|
||||
assertEquals(64, tier.getJSONObject("waterfallMinDrop").getInt("maximum"));
|
||||
assertEquals(64, tier.getJSONObject("bankBand").getInt("maximum"));
|
||||
assertEquals(0.05D, tier.getJSONObject("depthRatio").getDouble("minimum"), 0D);
|
||||
assertEquals(List.of("SMOOTH", "LINEAR", "CONCAVE", "TERRACED", "CLIFF"),
|
||||
|
||||
@@ -101,7 +101,7 @@ public final class WaterScene {
|
||||
halfWidth[point] = tier.minHalfWidth();
|
||||
depth[point] = tier.depth(tier.minHalfWidth());
|
||||
int drop = point == 0 ? 0 : grades[point - 1] - grades[point];
|
||||
style[point] = drop >= tier.waterfallMinimumDrop() ? ReachStyle.WATERFALL
|
||||
style[point] = drop >= tier.waterfallMinDrop() ? ReachStyle.WATERFALL
|
||||
: drop >= 2 ? ReachStyle.CASCADE : drop == 1 ? ReachStyle.RIFFLE : ReachStyle.RUN;
|
||||
}
|
||||
return new Reach(id, tier, 0L, xs, zs, grades, halfWidth, depth, style, 1000f);
|
||||
|
||||
Reference in new issue
Block a user