mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-26 22:10:18 +00:00
Skip floating fields for plain parents
- parent biome lookups read the biome stream directly instead of building the boundary field - fields are only built where a parent with floating children needs edge distances
This commit is contained in:
1 parent
1df51b230d
commit
f2236a8482
2 files changed
+6
-12
No files matched your search
+1
-5
@@ -48,7 +48,7 @@ public final class FloatingIslandBoundarySampler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable IrisBiome parent(int x, int z) {
|
public @Nullable IrisBiome parent(int x, int z) {
|
||||||
return parentField(x, z, EDGE_TAPER_WIDTH).parent(x, z);
|
return source.sample(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double edgeFade(IrisBiome parent, int x, int z) {
|
public double edgeFade(IrisBiome parent, int x, int z) {
|
||||||
@@ -230,10 +230,6 @@ public final class FloatingIslandBoundarySampler {
|
|||||||
build(source);
|
build(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
private @Nullable IrisBiome parent(int x, int z) {
|
|
||||||
return parents[geometry.index(x - minX, z - minZ)];
|
|
||||||
}
|
|
||||||
|
|
||||||
private int edgeDistance(IrisBiome expected, int x, int z) {
|
private int edgeDistance(IrisBiome expected, int x, int z) {
|
||||||
int index = geometry.index(x - minX, z - minZ);
|
int index = geometry.index(x - minX, z - minZ);
|
||||||
if (!sameBiome(expected, parents[index]) || !viable[index]) {
|
if (!sameBiome(expected, parents[index]) || !viable[index]) {
|
||||||
|
|||||||
+5
-7
@@ -103,20 +103,18 @@ public class FloatingIslandBoundarySamplerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void parent_cachesResolvedBiomeColumns() {
|
public void parent_readsOnlyTheQueriedColumnWithoutBuildingTheBoundaryField() {
|
||||||
IrisBiome parent = new IrisBiome();
|
IrisBiome parent = new IrisBiome();
|
||||||
|
IrisBiome other = new IrisBiome();
|
||||||
AtomicInteger calls = new AtomicInteger();
|
AtomicInteger calls = new AtomicInteger();
|
||||||
FloatingIslandBoundarySampler sampler = new FloatingIslandBoundarySampler((x, z) -> {
|
FloatingIslandBoundarySampler sampler = new FloatingIslandBoundarySampler((x, z) -> {
|
||||||
calls.incrementAndGet();
|
calls.incrementAndGet();
|
||||||
return parent;
|
return x == 12 && z == -9 ? parent : other;
|
||||||
});
|
});
|
||||||
|
|
||||||
assertSame(parent, sampler.parent(12, -9));
|
assertSame(parent, sampler.parent(12, -9));
|
||||||
int firstReadCount = calls.get();
|
assertSame(other, sampler.parent(13, -9));
|
||||||
assertSame(parent, sampler.parent(12, -9));
|
assertEquals(2, calls.get());
|
||||||
assertEquals(firstReadCount, calls.get());
|
|
||||||
int rawWidth = 16 + (FloatingIslandBoundarySampler.EDGE_FADE_RADIUS * 2) + 2;
|
|
||||||
assertEquals(rawWidth * rawWidth, firstReadCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in new issue
Block a user