mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +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
+1
-1
@@ -28,7 +28,7 @@ public class IrisHydrologyDrainage {
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Description("Smallest share of stream heads kept in the driest areas when wetness thinning is on.")
|
||||
private double minimumHeadKeep = 0.25D;
|
||||
private double minHeadKeep = 0.25D;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import lombok.experimental.Accessors;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@Description("Large lakes that fill the biggest hollows in the terrain. Each lake has one water level across its whole surface. A hollow becomes a lake only when it is at least ponds.natural.minDepth deep and no more than 2048 blocks across. Lakes take their freeboard, climateDrawdown, shore roundness, materials, decorators and fluid from ponds.")
|
||||
@Description("Large lakes that fill the biggest hollows in the terrain. Each lake has one water level across its whole surface. A hollow becomes a lake only when it is at least ponds.natural.minDepth deep and no more than 2048 blocks across. Lakes take their freeboard, dryDrawdown, shore roundness, materials, decorators and fluid from ponds.")
|
||||
@Data
|
||||
public class IrisHydrologyLakes {
|
||||
@Description("Turns large hollows into lakes.")
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import lombok.experimental.Accessors;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@Description("Standing water above sea level. Ponds fill natural hollows, seeded cups and optional dams, each with its own level, so ponds sit at many heights and streams link them into chains. Lakes take their freeboard, climateDrawdown, shore roundness, materials, decorators and fluid from here as well.")
|
||||
@Description("Standing water above sea level. Ponds fill natural hollows, seeded cups and optional dams, each with its own level, so ponds sit at many heights and streams link them into chains. Lakes take their freeboard, dryDrawdown, shore roundness, materials, decorators and fluid from here as well.")
|
||||
@Data
|
||||
public class IrisHydrologyPonds {
|
||||
@Description("Ponds that fill hollows already present in the terrain.")
|
||||
@@ -32,7 +32,7 @@ public class IrisHydrologyPonds {
|
||||
@MinNumber(0)
|
||||
@MaxNumber(32)
|
||||
@Description("Most extra blocks a pond or lake surface drops below its freeboard, in the driest areas. The drop is this value times the dryness at the floor, rounded: one minus the zone wetness, after the area's wetness bounds, where the dimension's wet and dry zones apply, and one minus the area's rainfall elsewhere, so water at a wetness or rainfall of 1 or more stays full.")
|
||||
private int climateDrawdown = 6;
|
||||
private int dryDrawdown = 6;
|
||||
|
||||
@Description("Shape of pond shores and floors. Lakes take only its roundness.")
|
||||
private IrisPondShore shore = new IrisPondShore();
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class IrisHydrologyTier {
|
||||
@MinNumber(2)
|
||||
@MaxNumber(64)
|
||||
@Description("Smallest drop in blocks that becomes a waterfall.")
|
||||
private int waterfallMinimumDrop = 6;
|
||||
private int waterfallMinDrop = 6;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
|
||||
+3
-3
@@ -9,16 +9,16 @@ import lombok.experimental.Accessors;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@Description("Bounds on how wet the dimension's wet and dry zones make this area. The zone wetness runs from the climate's dryRainfall in dry zones to 1 in wet zones and is held between min and max here. The bounded wetness scales rainfall and pond density, and a pond or lake whose floor lies here drops ponds.climateDrawdown times one minus it, rounded, below its freeboard.")
|
||||
@Description("Bounds on how wet the dimension's wet and dry zones make this area. The zone wetness runs from the climate's dryRainfall in dry zones to 1 in wet zones and is held between min and max here. The bounded wetness scales rainfall and pond density, and a pond or lake whose floor lies here drops ponds.dryDrawdown times one minus it, rounded, below its freeboard.")
|
||||
@Data
|
||||
public class IrisHydrologyWetness {
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Description("Lowest wetness this area falls to, even inside a dry zone. 0.7 keeps 70% of the rainfall and pond density in dry zones and lowers ponds and lakes by at most 30% of ponds.climateDrawdown. Left out, it is 0.")
|
||||
@Description("Lowest wetness this area falls to, even inside a dry zone. 0.7 keeps 70% of the rainfall and pond density in dry zones and lowers ponds and lakes by at most 30% of ponds.dryDrawdown. Left out, it is 0.")
|
||||
private double min = 0D;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Description("Highest wetness this area reaches, even inside a wet zone. 0.35 keeps at most 35% of the rainfall and pond density and lowers ponds and lakes by at least 65% of ponds.climateDrawdown. Must not be below min. Left out, it is 1.")
|
||||
@Description("Highest wetness this area reaches, even inside a wet zone. 0.35 keeps at most 35% of the rainfall and pond density and lowers ponds and lakes by at least 65% of ponds.dryDrawdown. Must not be below min. Left out, it is 1.")
|
||||
private double max = 1D;
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class IrisSeaInlets {
|
||||
@MinNumber(1)
|
||||
@MaxNumber(128)
|
||||
@Description("Height in blocks the coastal land must rise above sea level to be a site. The passage also needs ground at least headroom min + roofClearance + 2 blocks above sea level within about 16 blocks of the coast, so gentle coasts hold no inlets.")
|
||||
private int minimumCliffHeight = 8;
|
||||
private int minCliffHeight = 8;
|
||||
|
||||
@ArrayType(type = Integer.class, min = 2)
|
||||
@Description("Length of an inlet in blocks, written as [min, max]. The max plus 12, plus the larger of halfWidth max and chamberRadius max, plus 3 must not exceed 512.")
|
||||
|
||||
+12
-12
@@ -219,7 +219,7 @@ public final class HydrologySettings {
|
||||
|
||||
private static Drainage drainage(IrisHydrologyDrainage config) {
|
||||
return new Drainage((float) config.getFillEpsilon(), config.getBreachDepth(), config.isWetnessThinning(),
|
||||
(float) config.getMinimumHeadKeep(), (float) config.getHeadRelief(), (float) config.getSaturationCatchment());
|
||||
(float) config.getMinHeadKeep(), (float) config.getHeadRelief(), (float) config.getSaturationCatchment());
|
||||
}
|
||||
|
||||
private static List<HydrologyTier> tiers(List<IrisHydrologyTier> configs) {
|
||||
@@ -258,7 +258,7 @@ public final class HydrologySettings {
|
||||
}
|
||||
return new HydrologyTier(config.getName(), (float) config.getMinCatchment(), halfWidth.min(), halfWidth.max(),
|
||||
(float) config.getWidthFactor(), (float) config.getDepthRatio(), config.getInset(), config.isCascades(),
|
||||
config.getWaterfallMinimumDrop(), config.getBankBand(), config.getBankStyle(),
|
||||
config.getWaterfallMinDrop(), config.getBankBand(), config.getBankStyle(),
|
||||
estuary(config.getEstuary(), field + ".estuary"), delta(config, halfWidth.max(), field + ".delta"),
|
||||
materials(config.getMaterials(), field + ".materials"), config.getFluid(), decorators(config.getDecorators(), field + ".decorators"));
|
||||
}
|
||||
@@ -310,7 +310,7 @@ public final class HydrologySettings {
|
||||
return new Ponds(naturalPonds(config.getNatural()), seededPonds(config.getSeeded()),
|
||||
new PondDams(dams.isEnabled(), dams.getMaxRaise()),
|
||||
intRange(config.getFreeboard(), "ponds.freeboard", RangeFloor.NON_NEGATIVE),
|
||||
config.getClimateDrawdown(), pondShore(config.getShore()), materials(config.getMaterials(), "ponds.materials"), config.getFluid(),
|
||||
config.getDryDrawdown(), pondShore(config.getShore()), materials(config.getMaterials(), "ponds.materials"), config.getFluid(),
|
||||
decorators(config.getDecorators(), "ponds.decorators"));
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ public final class HydrologySettings {
|
||||
}
|
||||
|
||||
private SeaInlets seaInlets(IrisSeaInlets config) {
|
||||
SeaInlets inlets = new SeaInlets(config.isEnabled(), config.getSpacing(), config.getMinimumCliffHeight(),
|
||||
SeaInlets inlets = new SeaInlets(config.isEnabled(), config.getSpacing(), config.getMinCliffHeight(),
|
||||
intRange(config.getLength(), "underground.seaInlets.length", RangeFloor.POSITIVE),
|
||||
floatRange(config.getHalfWidth(), "underground.seaInlets.halfWidth", RangeFloor.POSITIVE),
|
||||
intRange(config.getDepth(), "underground.seaInlets.depth", RangeFloor.POSITIVE),
|
||||
@@ -582,7 +582,7 @@ public final class HydrologySettings {
|
||||
private static void requireTierBounds(IrisHydrologyTier config, String field) {
|
||||
requireNonNegative(config.getWidthFactor(), field + ".widthFactor");
|
||||
requireNonNegative(config.getDepthRatio(), field + ".depthRatio");
|
||||
requireAtLeast(config.getWaterfallMinimumDrop(), MIN_WATERFALL_DROP, field + ".waterfallMinimumDrop");
|
||||
requireAtLeast(config.getWaterfallMinDrop(), MIN_WATERFALL_DROP, field + ".waterfallMinDrop");
|
||||
requireShoreDepth(config.getMaterials(), field + ".materials");
|
||||
}
|
||||
|
||||
@@ -679,7 +679,7 @@ public final class HydrologySettings {
|
||||
|
||||
private void addDrainage(Fingerprint hash) {
|
||||
hash.add(drainage.fillEpsilon()).add(drainage.breachDepth()).add(drainage.wetnessThinning())
|
||||
.add(drainage.minimumHeadKeep()).add(drainage.headRelief()).add(drainage.saturationCatchment());
|
||||
.add(drainage.minHeadKeep()).add(drainage.headRelief()).add(drainage.saturationCatchment());
|
||||
}
|
||||
|
||||
private void addTiers(Fingerprint hash) {
|
||||
@@ -687,7 +687,7 @@ public final class HydrologySettings {
|
||||
for (HydrologyTier tier : tiers) {
|
||||
hash.add(tier.name()).add(tier.minCatchment()).add(tier.minHalfWidth()).add(tier.maxHalfWidth())
|
||||
.add(tier.widthFactor()).add(tier.depthRatio()).add(tier.inset()).add(tier.cascades())
|
||||
.add(tier.waterfallMinimumDrop()).add(tier.bankBand()).add(tier.bankStyle())
|
||||
.add(tier.waterfallMinDrop()).add(tier.bankBand()).add(tier.bankStyle())
|
||||
.add(tier.estuary().length()).add(tier.estuary().flare())
|
||||
.add(tier.delta().channels()).add(tier.delta().spreadDegrees()).add(tier.delta().length())
|
||||
.add(tier.materials()).add(tier.fluid());
|
||||
@@ -703,7 +703,7 @@ public final class HydrologySettings {
|
||||
.add(seeded.enabled()).add(seeded.density()).add(seeded.radius()).add(seeded.depth())
|
||||
.add(seeded.maxSlope()).add(seeded.alongChannels()).add(seeded.channelSpacing())
|
||||
.add(ponds.dams().enabled()).add(ponds.dams().maxRaise())
|
||||
.add(ponds.freeboard()).add(ponds.climateDrawdown())
|
||||
.add(ponds.freeboard()).add(ponds.dryDrawdown())
|
||||
.add(shore.roundness()).add(shore.shelf()).add(shore.taper()).add(shore.maxDepth())
|
||||
.add(ponds.materials()).add(ponds.fluid());
|
||||
}
|
||||
@@ -717,7 +717,7 @@ public final class HydrologySettings {
|
||||
private void addUnderground(Fingerprint hash) {
|
||||
SeaInlets inlets = underground.seaInlets();
|
||||
CavePools pools = underground.cavePools();
|
||||
hash.add(inlets.enabled()).add(inlets.spacing()).add(inlets.minimumCliffHeight()).add(inlets.length())
|
||||
hash.add(inlets.enabled()).add(inlets.spacing()).add(inlets.minCliffHeight()).add(inlets.length())
|
||||
.add(inlets.halfWidth()).add(inlets.depth()).add(inlets.headroom()).add(inlets.roofClearance())
|
||||
.add(inlets.chamberRadius())
|
||||
.add(pools.enabled()).add(pools.density()).add(pools.minArea()).add(pools.maxArea())
|
||||
@@ -754,7 +754,7 @@ public final class HydrologySettings {
|
||||
}
|
||||
}
|
||||
|
||||
public record Drainage(float fillEpsilon, int breachDepth, boolean wetnessThinning, float minimumHeadKeep, float headRelief,
|
||||
public record Drainage(float fillEpsilon, int breachDepth, boolean wetnessThinning, float minHeadKeep, float headRelief,
|
||||
float saturationCatchment) {
|
||||
}
|
||||
|
||||
@@ -772,7 +772,7 @@ public final class HydrologySettings {
|
||||
}
|
||||
|
||||
public record Ponds(NaturalPonds natural, SeededPonds seeded, PondDams dams, IntRange freeboard,
|
||||
int climateDrawdown, PondShore shore, IrisHydrologyMaterials materials, String fluid,
|
||||
int dryDrawdown, PondShore shore, IrisHydrologyMaterials materials, String fluid,
|
||||
List<IrisDecorator> decorators) {
|
||||
}
|
||||
|
||||
@@ -782,7 +782,7 @@ public final class HydrologySettings {
|
||||
public record Deformation(int maxFill, float bankSlope, float bankSteepFactor, float bankNoise, boolean caveMask) {
|
||||
}
|
||||
|
||||
public record SeaInlets(boolean enabled, int spacing, int minimumCliffHeight, IntRange length, FloatRange halfWidth,
|
||||
public record SeaInlets(boolean enabled, int spacing, int minCliffHeight, IntRange length, FloatRange halfWidth,
|
||||
IntRange depth, IntRange headroom, int roofClearance, IntRange chamberRadius) {
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ public final class WindowPlanner {
|
||||
|
||||
private boolean keepHead(DemGrid surface, int cell, float rainfall) {
|
||||
HydrologySettings.Drainage drainage = settings.drainage();
|
||||
float keep = drainage.wetnessThinning() ? Math.clamp(Math.max(drainage.minimumHeadKeep(), rainfall), 0f, 1f) : 1f;
|
||||
float keep = drainage.wetnessThinning() ? Math.clamp(Math.max(drainage.minHeadKeep(), rainfall), 0f, 1f) : 1f;
|
||||
keep *= settings.density();
|
||||
return CellHash.unit(CellHash.mix(settings.seed(), SALT_HEAD, surface.blockX(cell), surface.blockZ(cell))) < keep;
|
||||
}
|
||||
|
||||
@@ -60,13 +60,13 @@ public final class LinkBlend {
|
||||
int[] grade = feeder.grade();
|
||||
int level = junction.level();
|
||||
boolean[] fixed = fixed(feeder, lips, junction.fed() && grade[0] - level > ConfluenceGrader.MAX_START_LOWERING);
|
||||
int waterfallMinimumDrop = feeder.tier().waterfallMinimumDrop();
|
||||
int[] settled = ConfluenceGrader.settle(footprint(feeder), grade, fixed, receiving, level, waterfallMinimumDrop);
|
||||
int waterfallMinDrop = feeder.tier().waterfallMinDrop();
|
||||
int[] settled = ConfluenceGrader.settle(footprint(feeder), grade, fixed, receiving, level, waterfallMinDrop);
|
||||
if (settled == grade) {
|
||||
return feeder;
|
||||
}
|
||||
if (!feeder.tier().cascades()) {
|
||||
ConfluenceGrader.spreadJunction(settled, grade, fixed, waterfallMinimumDrop, Integer.MIN_VALUE);
|
||||
ConfluenceGrader.spreadJunction(settled, grade, fixed, waterfallMinDrop, Integer.MIN_VALUE);
|
||||
}
|
||||
return regraded(feeder, settled, feeder.halfWidth(), feeder.depth(), seaLevel);
|
||||
}
|
||||
@@ -101,19 +101,19 @@ public final class LinkBlend {
|
||||
}
|
||||
|
||||
private static Reach regraded(Reach reach, int[] grade, float[] halfWidth, float[] depth, int seaLevel) {
|
||||
ReachStyle[] style = grade == reach.grade() ? reach.style() : restyled(reach.style(), grade, reach.tier().waterfallMinimumDrop(), seaLevel);
|
||||
ReachStyle[] style = grade == reach.grade() ? reach.style() : restyled(reach.style(), grade, reach.tier().waterfallMinDrop(), seaLevel);
|
||||
return new Reach(reach.id(), reach.tier(), reach.downstreamId(), reach.xs(), reach.zs(), grade, halfWidth, depth, style,
|
||||
reach.catchment());
|
||||
}
|
||||
|
||||
private static ReachStyle[] restyled(ReachStyle[] style, int[] grade, int waterfallMinimumDrop, int seaLevel) {
|
||||
private static ReachStyle[] restyled(ReachStyle[] style, int[] grade, int waterfallMinDrop, int seaLevel) {
|
||||
boolean[] mouth = new boolean[style.length];
|
||||
boolean[] outlet = new boolean[style.length];
|
||||
for (int point = 0; point < style.length; point++) {
|
||||
mouth[point] = style[point] == ReachStyle.MOUTH;
|
||||
outlet[point] = style[point] == ReachStyle.POND_OUTLET;
|
||||
}
|
||||
return ReachShaper.styles(grade, mouth, outlet, waterfallMinimumDrop, seaLevel);
|
||||
return ReachShaper.styles(grade, mouth, outlet, waterfallMinDrop, seaLevel);
|
||||
}
|
||||
|
||||
private static int lowestEnd(List<Reach> feeders) {
|
||||
|
||||
@@ -284,7 +284,7 @@ final class RasterComposer {
|
||||
continue;
|
||||
}
|
||||
int drop = 0;
|
||||
int waterfallMinimumDrop = Integer.MAX_VALUE;
|
||||
int waterfallMinDrop = Integer.MAX_VALUE;
|
||||
for (int side : SIDES) {
|
||||
int upper = cell + side;
|
||||
if (!role[upper].flowing() || feature[upper] == feature[cell]) {
|
||||
@@ -293,11 +293,11 @@ final class RasterComposer {
|
||||
int step = head[upper] - head[cell];
|
||||
if (step >= 2 && step > drop) {
|
||||
drop = step;
|
||||
waterfallMinimumDrop = tier[upper].waterfallMinimumDrop();
|
||||
waterfallMinDrop = tier[upper].waterfallMinDrop();
|
||||
}
|
||||
}
|
||||
if (drop > 0) {
|
||||
role[cell] = drop >= waterfallMinimumDrop ? WaterRole.WATERFALL : WaterRole.CASCADE;
|
||||
role[cell] = drop >= waterfallMinDrop ? WaterRole.WATERFALL : WaterRole.CASCADE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -100,7 +100,7 @@ public final class SeaInletPlanner {
|
||||
private Map<Long, List<Integer>> sites(Terrain terrain, HydrologySettings.SeaInlets config) {
|
||||
Map<Long, List<Integer>> sites = new TreeMap<>();
|
||||
DemGrid grid = terrain.grid;
|
||||
float cliff = settings.seaLevel() + config.minimumCliffHeight();
|
||||
float cliff = settings.seaLevel() + config.minCliffHeight();
|
||||
for (int j = 1; j < grid.depth() - 1; j++) {
|
||||
for (int i = 1; i < grid.width() - 1; i++) {
|
||||
int cell = grid.index(i, j);
|
||||
@@ -467,7 +467,7 @@ public final class SeaInletPlanner {
|
||||
if (columns.first() < 0L || rows.first() < 0L || columns.last() > lastColumn || rows.last() > lastRow) {
|
||||
return true;
|
||||
}
|
||||
float cliff = settings.seaLevel() + config.minimumCliffHeight();
|
||||
float cliff = settings.seaLevel() + config.minCliffHeight();
|
||||
for (int i = (int) columns.first(); i <= columns.last(); i++) {
|
||||
if (rows.first() == 0L && cliffLand(terrain, i, 0, cliff) || rows.last() == lastRow && cliffLand(terrain, i, lastRow, cliff)) {
|
||||
return true;
|
||||
|
||||
@@ -18,7 +18,7 @@ public final class ConfluenceGrader {
|
||||
public record Footprint(float[] xs, float[] zs, float[] halfWidth) {
|
||||
}
|
||||
|
||||
public static int[] settle(Footprint feeder, int[] grade, boolean[] fixed, List<Footprint> receiving, int level, int waterfallMinimumDrop) {
|
||||
public static int[] settle(Footprint feeder, int[] grade, boolean[] fixed, List<Footprint> receiving, int level, int waterfallMinDrop) {
|
||||
int last = grade.length - 1;
|
||||
double[] arc = arcFromEnd(feeder);
|
||||
int[] settled = lower(grade, grade, last, level);
|
||||
@@ -27,20 +27,20 @@ public final class ConfluenceGrader {
|
||||
settled = lower(settled, grade, point, level);
|
||||
edge = point;
|
||||
}
|
||||
int meet = approach(grade, fixed, arc, edge, level, waterfallMinimumDrop);
|
||||
int meet = approach(grade, fixed, arc, edge, level, waterfallMinDrop);
|
||||
for (int point = edge - 1; point > meet; point--) {
|
||||
settled = lower(settled, grade, point, envelope(arc, edge, point, level));
|
||||
}
|
||||
return settled;
|
||||
}
|
||||
|
||||
public static void spreadJunction(int[] settled, int[] grade, boolean[] fixed, int waterfallMinimumDrop, int startLimit) {
|
||||
public static void spreadJunction(int[] settled, int[] grade, boolean[] fixed, int waterfallMinDrop, int startLimit) {
|
||||
int lowered = 0;
|
||||
while (settled[lowered] == grade[lowered]) {
|
||||
lowered++;
|
||||
}
|
||||
for (int point = settled.length - 2; point >= 0; point--) {
|
||||
if (!ReachGrader.spreadPoint(settled, point, waterfallMinimumDrop, startLimit, fixed) && point < lowered) {
|
||||
if (!ReachGrader.spreadPoint(settled, point, waterfallMinDrop, startLimit, fixed) && point < lowered) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -55,14 +55,14 @@ public final class ConfluenceGrader {
|
||||
requireJunction(window, draft, downstream);
|
||||
boolean[] fixed = draft.fixed();
|
||||
fixed[0] |= draft.incoming.length > 0 && draft.grade[0] - downstream.grade[0] > MAX_START_LOWERING;
|
||||
int waterfallMinimumDrop = draft.tier.waterfallMinimumDrop();
|
||||
int waterfallMinDrop = draft.tier.waterfallMinDrop();
|
||||
int[] settled = settle(footprint(draft), draft.grade, fixed, receiving(drafts, downstream, feeder), downstream.grade[0],
|
||||
waterfallMinimumDrop);
|
||||
waterfallMinDrop);
|
||||
if (settled == draft.grade) {
|
||||
continue;
|
||||
}
|
||||
if (!draft.tier.cascades()) {
|
||||
spreadJunction(settled, draft.grade, fixed, waterfallMinimumDrop, ReachGrader.startLimit(drafts, draft));
|
||||
spreadJunction(settled, draft.grade, fixed, waterfallMinDrop, ReachGrader.startLimit(drafts, draft));
|
||||
}
|
||||
draft.grade = settled;
|
||||
touched[feeder] = true;
|
||||
@@ -116,8 +116,8 @@ public final class ConfluenceGrader {
|
||||
return beside && lowering <= MARGIN_LOWERING;
|
||||
}
|
||||
|
||||
private static int approach(int[] grade, boolean[] fixed, double[] arc, int edge, int level, int waterfallMinimumDrop) {
|
||||
double window = (waterfallMinimumDrop - 1) / (double) APPROACH_SLOPE;
|
||||
private static int approach(int[] grade, boolean[] fixed, double[] arc, int edge, int level, int waterfallMinDrop) {
|
||||
double window = (waterfallMinDrop - 1) / (double) APPROACH_SLOPE;
|
||||
for (int point = edge - 1; point >= 0 && arc[point] - arc[edge] <= window; point--) {
|
||||
if (grade[point] <= envelope(arc, edge, point, level)) {
|
||||
return point;
|
||||
|
||||
@@ -15,7 +15,7 @@ public record HydrologyTier(
|
||||
float depthRatio,
|
||||
int inset,
|
||||
boolean cascades,
|
||||
int waterfallMinimumDrop,
|
||||
int waterfallMinDrop,
|
||||
int bankBand,
|
||||
IrisBankStyle bankStyle,
|
||||
Estuary estuary,
|
||||
|
||||
@@ -776,7 +776,7 @@ public final class PondPlanner {
|
||||
}
|
||||
|
||||
private int drawdown(float dryness) {
|
||||
return Math.round(settings.ponds().climateDrawdown() * dryness);
|
||||
return Math.round(settings.ponds().dryDrawdown() * dryness);
|
||||
}
|
||||
|
||||
private static int radius(DemGrid raw, Basin basin) {
|
||||
|
||||
@@ -74,7 +74,7 @@ final class ReachGrader {
|
||||
for (int position = upstreamFirst.length - 1; position >= 0; position--) {
|
||||
ReachDraft draft = drafts.get(upstreamFirst[position]);
|
||||
if (!draft.tier.cascades()) {
|
||||
spread(draft.grade, draft.tier.waterfallMinimumDrop(), startLimit(drafts, draft), draft.held);
|
||||
spread(draft.grade, draft.tier.waterfallMinDrop(), startLimit(drafts, draft), draft.held);
|
||||
}
|
||||
lowerIncomingEnds(drafts, draft);
|
||||
}
|
||||
@@ -158,16 +158,16 @@ final class ReachGrader {
|
||||
int limit = Integer.MIN_VALUE;
|
||||
for (int upstream : draft.incoming) {
|
||||
ReachDraft feeder = drafts.get(upstream);
|
||||
limit = Math.max(limit, carryLimit(feeder.grade, feeder.grade.length - 1, feeder.tier.waterfallMinimumDrop()));
|
||||
limit = Math.max(limit, carryLimit(feeder.grade, feeder.grade.length - 1, feeder.tier.waterfallMinDrop()));
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
private static int carryLimit(int[] grade, int point, int waterfallMinimumDrop) {
|
||||
if (point == 0 || grade[point - 1] - grade[point] >= waterfallMinimumDrop) {
|
||||
private static int carryLimit(int[] grade, int point, int waterfallMinDrop) {
|
||||
if (point == 0 || grade[point - 1] - grade[point] >= waterfallMinDrop) {
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
return grade[point - 1] - (waterfallMinimumDrop - 1);
|
||||
return grade[point - 1] - (waterfallMinDrop - 1);
|
||||
}
|
||||
|
||||
private static int[] profile(List<ReachDraft> drafts, ReachDraft draft) {
|
||||
@@ -210,18 +210,18 @@ final class ReachGrader {
|
||||
return sorted[Math.max(0, (int) Math.ceil(POOL_QUANTILE * sorted.length) - 1)];
|
||||
}
|
||||
|
||||
private static void spread(int[] grade, int waterfallMinimumDrop, int startLimit, boolean[] held) {
|
||||
private static void spread(int[] grade, int waterfallMinDrop, int startLimit, boolean[] held) {
|
||||
for (int point = grade.length - 2; point >= 0; point--) {
|
||||
spreadPoint(grade, point, waterfallMinimumDrop, startLimit, held);
|
||||
spreadPoint(grade, point, waterfallMinDrop, startLimit, held);
|
||||
}
|
||||
}
|
||||
|
||||
static boolean spreadPoint(int[] grade, int point, int waterfallMinimumDrop, int startLimit, boolean[] held) {
|
||||
static boolean spreadPoint(int[] grade, int point, int waterfallMinDrop, int startLimit, boolean[] held) {
|
||||
int drop = grade[point] - grade[point + 1];
|
||||
if (drop < 2 || drop >= waterfallMinimumDrop || held != null && held[point]) {
|
||||
if (drop < 2 || drop >= waterfallMinDrop || held != null && held[point]) {
|
||||
return false;
|
||||
}
|
||||
int limit = point == 0 ? startLimit : carryLimit(grade, point, waterfallMinimumDrop);
|
||||
int limit = point == 0 ? startLimit : carryLimit(grade, point, waterfallMinDrop);
|
||||
int spread = Math.min(grade[point], Math.max(grade[point + 1] + 1, limit));
|
||||
boolean lowered = spread < grade[point];
|
||||
grade[point] = spread;
|
||||
|
||||
@@ -385,7 +385,7 @@ public final class ReachShaper {
|
||||
}
|
||||
|
||||
private static void restyle(ReachDraft draft, int seaLevel) {
|
||||
draft.style = styles(draft.grade, draft.ocean, draft.fixed(), draft.tier.waterfallMinimumDrop(), seaLevel);
|
||||
draft.style = styles(draft.grade, draft.ocean, draft.fixed(), draft.tier.waterfallMinDrop(), seaLevel);
|
||||
}
|
||||
|
||||
private static void chaikin(ReachDraft draft) {
|
||||
@@ -548,11 +548,11 @@ public final class ReachShaper {
|
||||
return Math.clamp(1f - remaining / length, 0f, 1f);
|
||||
}
|
||||
|
||||
public static ReachStyle[] styles(int[] grade, boolean[] ocean, boolean[] outletZone, int waterfallMinimumDrop, int seaLevel) {
|
||||
public static ReachStyle[] styles(int[] grade, boolean[] ocean, boolean[] outletZone, int waterfallMinDrop, int seaLevel) {
|
||||
ReachStyle[] styles = new ReachStyle[grade.length];
|
||||
for (int point = 0; point < grade.length; point++) {
|
||||
int drop = point == 0 ? 0 : grade[point - 1] - grade[point];
|
||||
styles[point] = style(drop, waterfallMinimumDrop, ocean[point], outletZone[point]);
|
||||
styles[point] = style(drop, waterfallMinDrop, ocean[point], outletZone[point]);
|
||||
if (drop == 1 && !ocean[point] && outletZone[point - 1]
|
||||
&& WaterHeads.snap(grade[point - 1], seaLevel) - WaterHeads.snap(grade[point], seaLevel) >= 2) {
|
||||
styles[point] = ReachStyle.CASCADE;
|
||||
@@ -560,18 +560,18 @@ public final class ReachShaper {
|
||||
}
|
||||
for (int point = 1; point < grade.length; point++) {
|
||||
if (styles[point] == ReachStyle.MOUTH && styles[point - 1] != ReachStyle.MOUTH
|
||||
&& grade[point - 1] - grade[point] >= waterfallMinimumDrop) {
|
||||
&& grade[point - 1] - grade[point] >= waterfallMinDrop) {
|
||||
styles[point - 1] = ReachStyle.WATERFALL;
|
||||
}
|
||||
}
|
||||
return styles;
|
||||
}
|
||||
|
||||
private static ReachStyle style(int drop, int waterfallMinimumDrop, boolean mouth, boolean outlet) {
|
||||
private static ReachStyle style(int drop, int waterfallMinDrop, boolean mouth, boolean outlet) {
|
||||
if (mouth) {
|
||||
return ReachStyle.MOUTH;
|
||||
}
|
||||
if (drop >= waterfallMinimumDrop) {
|
||||
if (drop >= waterfallMinDrop) {
|
||||
return ReachStyle.WATERFALL;
|
||||
}
|
||||
if (drop >= 2) {
|
||||
|
||||
+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