mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-30 09:44:24 +00:00
Estuaries replace deltas
- Replace the tier deltas flag with estuary {length 48, flare 2.5}, validated in HydrologySettings and added to the fingerprint
- Grade ocean-ending reaches to sea level over the estuary while the lower bank lies within maxFill of the sea, stopping at held pond outlet points
- Style estuary points MOUTH and flare their half-width by 1 + (flare - 1) * s^2 toward the mouth, keeping the channel depth
- Fill MOUTH columns with the sea fluid so lava rivers meet the sea through their seam
- Paint MOUTH columns with the sea layers and ice of the sea floor, like INLET slots
- Stop bank levees from raising ground below sea level
- Recapture DEFAULT_FINGERPRINT and EXPECTED_SCHEMA_DIGEST
- Cover the estuary flare, mouth sea fluid, lava mouth seam, frozen mouth ice, the strict no-berm coastal fall and the coastal sea-floor scene
- Pin that tiers written with an unknown key load with the default estuary
This commit is contained in:
1 parent
11ce906e5b
commit
aef674f206
25 files changed
+470
-40
No files matched your search
@@ -45,8 +45,7 @@ public class IrisHydrology {
|
||||
.setHalfWidth(new KList<>(8D, 16D))
|
||||
.setDepthRatio(0.5D)
|
||||
.setInset(3)
|
||||
.setBankBand(48)
|
||||
.setDeltas(true));
|
||||
.setBankBand(48));
|
||||
|
||||
@Description("Standing water above sea level: natural hollows, seeded cups and dams.")
|
||||
private IrisHydrologyPonds ponds = new IrisHydrologyPonds();
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package art.arcane.iris.generation.hydrology.config;
|
||||
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.MinNumber;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@Description("Where a channel reaches the sea it widens into an estuary: water at sea level that holds the sea's own fluid, so the sea's surface layers and ice continue across it.")
|
||||
@Data
|
||||
public class IrisHydrologyEstuary {
|
||||
@MinNumber(0)
|
||||
@MaxNumber(256)
|
||||
@Description("Most blocks upstream of the mouth the estuary reaches. It stops where the lower bank rises more than deformation.maxFill blocks above sea level. 0 ends the channel in a plain mouth.")
|
||||
private int length = 48;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(4)
|
||||
@Description("Half-width at the mouth of a full-length estuary as a multiple of the channel's own half-width. The channel widens slowly at first and fastest near the mouth and keeps its own depth; an estuary cut short by higher banks widens less. The half-width never passes 64. 1 keeps the channel's width.")
|
||||
private double flare = 2.5D;
|
||||
}
|
||||
+2
-2
@@ -60,8 +60,8 @@ public class IrisHydrologyTier {
|
||||
@Description("Shape of the banks inside the bank band.")
|
||||
private IrisBankStyle bankStyle = IrisBankStyle.SMOOTH;
|
||||
|
||||
@Description("Spreads the channel into a delta where it reaches the sea.")
|
||||
private boolean deltas = false;
|
||||
@Description("How the channel widens into an estuary where it reaches the sea.")
|
||||
private IrisHydrologyEstuary estuary = new IrisHydrologyEstuary();
|
||||
|
||||
@Description("Blocks painted on the bed, shore and banks of this tier.")
|
||||
private IrisHydrologyMaterials materials = new IrisHydrologyMaterials();
|
||||
|
||||
+22
-3
@@ -9,6 +9,7 @@ import art.arcane.iris.generation.hydrology.config.IrisHydrologyClimate;
|
||||
import art.arcane.iris.generation.hydrology.config.IrisHydrology;
|
||||
import art.arcane.iris.generation.hydrology.config.IrisHydrologyDeformation;
|
||||
import art.arcane.iris.generation.hydrology.config.IrisHydrologyDrainage;
|
||||
import art.arcane.iris.generation.hydrology.config.IrisHydrologyEstuary;
|
||||
import art.arcane.iris.generation.hydrology.config.IrisHydrologyLakes;
|
||||
import art.arcane.iris.generation.hydrology.config.IrisHydrologyMaterials;
|
||||
import art.arcane.iris.generation.hydrology.config.IrisHydrologyPonds;
|
||||
@@ -36,6 +37,8 @@ import java.util.Objects;
|
||||
public final class HydrologySettings {
|
||||
private static final Gson PALETTE_JSON = new Gson();
|
||||
private static final int MAX_BANK_BAND = 64;
|
||||
private static final int MAX_ESTUARY_LENGTH = 256;
|
||||
private static final double MAX_ESTUARY_FLARE = 4D;
|
||||
public static final float MAX_HALF_WIDTH = 64f;
|
||||
private static final double MIN_INLET_HALF_WIDTH = 1D;
|
||||
private static final double MAX_INLET_HALF_WIDTH = 16D;
|
||||
@@ -238,11 +241,26 @@ 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.isDeltas(),
|
||||
materials(config.getMaterials(), field + ".materials"), config.getFluid(),
|
||||
config.getWaterfallMinimumDrop(), config.getBankBand(), config.getBankStyle(),
|
||||
estuary(config.getEstuary(), field + ".estuary"), materials(config.getMaterials(), field + ".materials"), config.getFluid(),
|
||||
decorators(config.getDecorators(), field + ".decorators"));
|
||||
}
|
||||
|
||||
private static HydrologyTier.Estuary estuary(IrisHydrologyEstuary config, String field) {
|
||||
if (config == null) {
|
||||
throw new IllegalArgumentException("Hydrology " + field + " must be an object");
|
||||
}
|
||||
if (config.getLength() < 0 || config.getLength() > MAX_ESTUARY_LENGTH) {
|
||||
throw new IllegalArgumentException("Hydrology " + field + ".length must stay within 0.." + MAX_ESTUARY_LENGTH + ", got "
|
||||
+ config.getLength());
|
||||
}
|
||||
if (!(config.getFlare() >= 1D && config.getFlare() <= MAX_ESTUARY_FLARE)) {
|
||||
throw new IllegalArgumentException("Hydrology " + field + ".flare must stay within 1.." + MAX_ESTUARY_FLARE + ", got "
|
||||
+ config.getFlare());
|
||||
}
|
||||
return new HydrologyTier.Estuary(config.getLength(), (float) config.getFlare());
|
||||
}
|
||||
|
||||
private static Ponds ponds(IrisHydrologyPonds config) {
|
||||
IrisPondDams dams = config.getDams();
|
||||
return new Ponds(naturalPonds(config.getNatural()), seededPonds(config.getSeeded()),
|
||||
@@ -549,7 +567,8 @@ 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.deltas())
|
||||
.add(tier.waterfallMinimumDrop()).add(tier.bankBand()).add(tier.bankStyle())
|
||||
.add(tier.estuary().length()).add(tier.estuary().flare())
|
||||
.add(tier.materials()).add(tier.fluid());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ final class RasterComposer {
|
||||
role[cell] = role(reach.style()[point]);
|
||||
feature[cell] = reach.id();
|
||||
tier[cell] = reach.tier();
|
||||
fluid[cell] = reachFluid(reach);
|
||||
fluid[cell] = role[cell] == WaterRole.MOUTH ? HydrologyCaveCell.SEA_FLUID : reachFluid(reach);
|
||||
}
|
||||
|
||||
private String reachFluid(Reach reach) {
|
||||
@@ -190,7 +190,7 @@ final class RasterComposer {
|
||||
if (ground >= surface) {
|
||||
double cone = coneSlope(steepestToWater(x, z, bank, bankEdge)) * u * bankTier.bankBand();
|
||||
cut = BankProfile.cut(bankTier.bankStyle(), surface, ground, u, cone, noise(x, z));
|
||||
} else {
|
||||
} else if (ground >= settings.seaLevel()) {
|
||||
raise = BankProfile.levee(bankTier.bankStyle(), surface, ground, u, noise(x, z), settings.deformation().maxFill());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public record HydrologyTier(
|
||||
int waterfallMinimumDrop,
|
||||
int bankBand,
|
||||
IrisBankStyle bankStyle,
|
||||
boolean deltas,
|
||||
Estuary estuary,
|
||||
IrisHydrologyMaterials materials,
|
||||
String fluid,
|
||||
List<IrisDecorator> decorators
|
||||
@@ -34,4 +34,7 @@ public record HydrologyTier(
|
||||
public float depth(float halfWidth) {
|
||||
return Math.max(MINIMUM_DEPTH, depthRatio * halfWidth);
|
||||
}
|
||||
|
||||
public record Estuary(int length, float flare) {
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,9 @@ final class ReachGrader {
|
||||
for (int upstream : draft.incoming) {
|
||||
level = Math.min(level, drafts.get(upstream).last());
|
||||
}
|
||||
if (draft.chain.end() == ReachTracer.End.OCEAN) {
|
||||
estuary(draft, seaLevel + maxFill);
|
||||
}
|
||||
int[] grade = profile(drafts, draft);
|
||||
for (int point = 0; point < grade.length; point++) {
|
||||
if (draft.held != null && draft.held[point] && !draft.ocean[point]) {
|
||||
@@ -78,6 +81,21 @@ final class ReachGrader {
|
||||
return levels;
|
||||
}
|
||||
|
||||
private static void estuary(ReachDraft draft, int highestBank) {
|
||||
int length = draft.tier.estuary().length();
|
||||
float along = 0f;
|
||||
for (int point = draft.xs.length - 1; point >= 0; point--) {
|
||||
if (point < draft.xs.length - 1) {
|
||||
along += (float) Math.hypot(draft.xs[point + 1] - draft.xs[point], draft.zs[point + 1] - draft.zs[point]);
|
||||
}
|
||||
boolean held = draft.held != null && draft.held[point];
|
||||
if (along > length || held || !draft.ocean[point] && draft.bank[point] > highestBank) {
|
||||
return;
|
||||
}
|
||||
draft.ocean[point] = true;
|
||||
}
|
||||
}
|
||||
|
||||
static int[] outletPonds(int[] outletDrafts, int drafts) {
|
||||
int[] outletPond = new int[drafts];
|
||||
Arrays.fill(outletPond, -1);
|
||||
|
||||
@@ -492,6 +492,7 @@ public final class ReachShaper {
|
||||
boolean flare = draft.incoming.length > 0 && !draft.outlet;
|
||||
boolean taper = !flare && !draft.outlet;
|
||||
float[] distance = distances(draft.xs, draft.zs);
|
||||
float[] estuary = estuaryFlare(draft, distance);
|
||||
float running = upstream;
|
||||
draft.halfWidth = new float[count];
|
||||
draft.depth = new float[count];
|
||||
@@ -503,13 +504,42 @@ public final class ReachShaper {
|
||||
law *= Math.min(1f, distance[point] / TAPER_LENGTH);
|
||||
}
|
||||
float lip = draft.held != null && draft.held[point] ? LIP_HALF_WIDTH : 0f;
|
||||
draft.halfWidth[point] = Math.max(Math.max(law, WAIST * running), lip);
|
||||
running = Math.max(running, draft.halfWidth[point]);
|
||||
draft.depth[point] = draft.tier.depth(draft.halfWidth[point]);
|
||||
float channel = Math.max(Math.max(law, WAIST * running), lip);
|
||||
draft.halfWidth[point] = Math.min(HydrologySettings.MAX_HALF_WIDTH, channel * estuary[point]);
|
||||
running = Math.max(running, channel);
|
||||
draft.depth[point] = draft.tier.depth(channel);
|
||||
}
|
||||
draft.maxHalfWidth = running;
|
||||
}
|
||||
|
||||
private static float[] estuaryFlare(ReachDraft draft, float[] distance) {
|
||||
int count = distance.length;
|
||||
float[] scale = new float[count];
|
||||
Arrays.fill(scale, 1f);
|
||||
if (draft.chain.end() != ReachTracer.End.OCEAN) {
|
||||
return scale;
|
||||
}
|
||||
HydrologyTier.Estuary estuary = draft.tier.estuary();
|
||||
float mouth = distance[count - 1];
|
||||
int start = count - 1;
|
||||
while (start > 0 && draft.ocean[start - 1] && mouth - distance[start - 1] <= estuary.length()) {
|
||||
start--;
|
||||
}
|
||||
if (start == count - 1) {
|
||||
return scale;
|
||||
}
|
||||
float first = towardMouth(mouth - distance[start], estuary.length());
|
||||
for (int point = start + 1; point < count; point++) {
|
||||
float toward = towardMouth(mouth - distance[point], estuary.length());
|
||||
scale[point] = 1f + (estuary.flare() - 1f) * (toward * toward - first * first);
|
||||
}
|
||||
return scale;
|
||||
}
|
||||
|
||||
private static float towardMouth(float remaining, int length) {
|
||||
return Math.clamp(1f - remaining / length, 0f, 1f);
|
||||
}
|
||||
|
||||
public static ReachStyle[] styles(int[] grade, boolean[] ocean, boolean[] outletZone, int waterfallMinimumDrop) {
|
||||
ReachStyle[] styles = new ReachStyle[grade.length];
|
||||
for (int point = 0; point < grade.length; point++) {
|
||||
|
||||
@@ -228,7 +228,7 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<NativeBloc
|
||||
WaterRole role = waterRoleStream.get(realX, realZ);
|
||||
boolean wet = role.wet();
|
||||
boolean submerged = wet && he < surfaceFluidHeight;
|
||||
boolean seaFloor = !wet || role == WaterRole.INLET;
|
||||
boolean seaFloor = !wet || role == WaterRole.INLET || role == WaterRole.MOUTH;
|
||||
IrisHydrologyMaterials materials = role == WaterRole.NONE || role == WaterRole.INLET ? null
|
||||
: complex.resolveWaterMaterials(realX, realZ);
|
||||
Terrain3DColumn terrainColumn = complex.terrainColumn(realX, realZ);
|
||||
|
||||
Reference in new issue
Block a user