mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-11 19:14:11 +00:00
Revert per-chunk hydrology samples
- painter read of the chunk column array changed bank and shore cut materials (three terrain actuator tests)
This commit is contained in:
@@ -537,14 +537,6 @@ public final class HydrologyTileCache implements AutoCloseable {
|
||||
chunkColumns(blockX, blockZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Every column of the block's chunk, indexed {@code localZ * 16 + localX}; a column without hydrology
|
||||
* is null. The array is shared with the cache and must not be modified.
|
||||
*/
|
||||
public HydrologyColumnSample[] chunkSamples(int blockX, int blockZ) {
|
||||
return chunkColumns(blockX, blockZ).columns();
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the column's chunk can be answered without planning: every tile it composes from is
|
||||
* already planned. A caller that must not wait (the server thread answering a height or biome
|
||||
|
||||
-5
@@ -195,11 +195,6 @@ public final class IrisHydrologyRuntime implements AutoCloseable {
|
||||
cache.prepareChunkColumns(blockX, blockZ);
|
||||
}
|
||||
|
||||
/** The block's chunk columns indexed {@code localZ * 16 + localX}; shared, never modified by callers. */
|
||||
public HydrologyColumnSample[] chunkSamples(int blockX, int blockZ) {
|
||||
return cache.chunkSamples(blockX, blockZ);
|
||||
}
|
||||
|
||||
/** Whether the chunk or one of its eight neighbours holds a planned footprint column. */
|
||||
public boolean hasColumnsAround(int chunkX, int chunkZ) {
|
||||
return cache.hasColumnsAround(chunkX, chunkZ);
|
||||
|
||||
@@ -1062,31 +1062,6 @@ public class IrisComplex implements DataProvider {
|
||||
return transitionHydrologySample(sample, hydrologyWeight, transitionDisplacement);
|
||||
}
|
||||
|
||||
/**
|
||||
* The raw hydrology columns of the chunk holding the block, for a caller that samples every column of
|
||||
* one chunk through {@link #sampleHydrologyColumn(HydrologyColumnSample[], int, int)}; null without
|
||||
* hydrology.
|
||||
*/
|
||||
public HydrologyColumnSample[] hydrologyChunkSamples(int x, int z) {
|
||||
return hydrologyRuntime == null ? null : hydrologyRuntime.chunkSamples(x, z);
|
||||
}
|
||||
|
||||
/** {@link #sampleHydrologyColumn(double, double)} for a column of the chunk {@code chunkSamples} came from. */
|
||||
public HydrologyColumnSample sampleHydrologyColumn(HydrologyColumnSample[] chunkSamples, int x, int z) {
|
||||
if (chunkSamples == null) {
|
||||
return null;
|
||||
}
|
||||
HydrologyColumnSample sample = chunkSamples[(z & 15) << 4 | (x & 15)];
|
||||
if (transitionGenerationPlan == null) {
|
||||
return sample;
|
||||
}
|
||||
double hydrologyWeight = transitionHydrologyWeight(x, z);
|
||||
if (sample == null) {
|
||||
return sample;
|
||||
}
|
||||
return transitionHydrologySample(sample, hydrologyWeight, transitionDisplacement);
|
||||
}
|
||||
|
||||
private HydrologyColumnSnapshot sampleHydrologySnapshot(int x, int z) {
|
||||
if (hydrologyRuntime == null) {
|
||||
return HydrologyColumnSnapshot.ready(null);
|
||||
|
||||
@@ -154,7 +154,6 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<NativeBloc
|
||||
private final IrisData data;
|
||||
private final IrisComplex complex;
|
||||
private final ProceduralStream<Double> riverWaterSurfaceStream;
|
||||
private final HydrologyColumnSample[] hydrologySamples;
|
||||
private final boolean bedrockEnabled;
|
||||
private final boolean hideOres;
|
||||
private final boolean transitionDisplaced;
|
||||
@@ -187,7 +186,6 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<NativeBloc
|
||||
data = getData();
|
||||
complex = getComplex();
|
||||
riverWaterSurfaceStream = complex.getRiverWaterSurfaceStream();
|
||||
hydrologySamples = complex.hydrologyChunkSamples(x, z);
|
||||
bedrockEnabled = dimension.isBedrock();
|
||||
hideOres = dimension.isHideOresForHiddenOre();
|
||||
transitionDisplaced = complex.getTransitionDisplacement() != null;
|
||||
@@ -228,7 +226,7 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<NativeBloc
|
||||
}
|
||||
|
||||
int topY = Math.min(hf, chunkHeight - 1);
|
||||
HydrologyColumnSample hydrology = complex.sampleHydrologyColumn(hydrologySamples, realX, realZ);
|
||||
HydrologyColumnSample hydrology = complex.sampleHydrologyColumn(realX, realZ);
|
||||
HydrologyColumnLayer hydrologyFluid = hydrology == null
|
||||
? null
|
||||
: hydrology.primarySurfaceFluidLayerOrNull();
|
||||
|
||||
@@ -1125,34 +1125,6 @@ public class HydrologyTileCacheTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void chunkSamplesMatchPerColumnLookups() {
|
||||
HydrologyTileCache perColumn = new HydrologyTileCache(new HydrologyPlanner(811L, featureSettings(), this::featureTerrain), 8);
|
||||
HydrologyTileCache perChunk = new HydrologyTileCache(new HydrologyPlanner(811L, featureSettings(), this::featureTerrain), 8);
|
||||
HydrologyColumnSample plannedColumn = perColumn.get(new HydrologyTileKey(0, 0)).footprint().columns().values().stream()
|
||||
.filter(HydrologyColumnSample::present)
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
int centreChunkX = Math.floorDiv(plannedColumn.x(), 16);
|
||||
int centreChunkZ = Math.floorDiv(plannedColumn.z(), 16);
|
||||
int present = 0;
|
||||
for (int chunkZ = centreChunkZ - 2; chunkZ <= centreChunkZ + 2; chunkZ++) {
|
||||
for (int chunkX = centreChunkX - 2; chunkX <= centreChunkX + 2; chunkX++) {
|
||||
HydrologyColumnSample[] samples = perChunk.chunkSamples(chunkX * 16 + 5, chunkZ * 16 + 11);
|
||||
assertEquals(256, samples.length);
|
||||
for (int localZ = 0; localZ < 16; localZ++) {
|
||||
for (int localX = 0; localX < 16; localX++) {
|
||||
HydrologyColumnSample expected = perColumn
|
||||
.columnAt(chunkX * 16 + localX, chunkZ * 16 + localZ).orElse(null);
|
||||
assertEquals(expected, samples[localZ * 16 + localX]);
|
||||
present += expected == null ? 0 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assertTrue(present > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void singleColumnContributionReusesItsImmutableSample() {
|
||||
HydrologyColumnSample sample = compositionSample(90, List.of(compositionLayer(11L, 80)));
|
||||
|
||||
Reference in New Issue
Block a user