mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-26 05:50:39 +00:00
Sample terrain height for ERODE_STILT
This commit is contained in:
1 parent
46d458e6e4
commit
b7499d23f2
3 files changed
+11
-9
No files matched your search
@@ -36,20 +36,13 @@ public final class PlacementModuleStilt implements PlacementModule {
|
||||
PlacementModule height = switch (mode) {
|
||||
case CENTER, ORGANIC, CEILING -> new PlacementModuleCenterHeight();
|
||||
case MIN -> new PlacementModuleHeight(PlacementModuleHeight.Mode.MIN, fast);
|
||||
case DEFAULT -> new PlacementModuleHeight(PlacementModuleHeight.Mode.MAX, fast);
|
||||
case ERODE -> PlacementModuleStilt::installUnsampledHeight;
|
||||
case DEFAULT, ERODE -> new PlacementModuleHeight(PlacementModuleHeight.Mode.MAX, fast);
|
||||
};
|
||||
height.install(lifecycle);
|
||||
lifecycle.add(FILL, PlacementStage.AFTER_BLOCKS, this::fill, PlacementModuleAnchor.HEIGHT,
|
||||
PlacementModuleBlocks.COMPLETE, PlacementModuleTreeGrounding.ROOTS);
|
||||
}
|
||||
|
||||
/** The legacy runner never sampled terrain for ERODE_STILT, so surface placements keep the unset height. */
|
||||
private static void installUnsampledHeight(PlacementLifecycleBuilder lifecycle) {
|
||||
PlacementModuleAnchor.install(lifecycle, (context, state, ignored) -> {
|
||||
});
|
||||
}
|
||||
|
||||
private static StiltLayers stiltLayers(ObjectPlacementBake bake, PlacementPalette palette) {
|
||||
int lowest = Integer.MAX_VALUE;
|
||||
int highest = Integer.MIN_VALUE;
|
||||
|
||||
+9
@@ -249,6 +249,15 @@ public class IrisObjectPlacementLifecycleRegressionTest {
|
||||
assertTrue(placer.writes().stream().noneMatch(write -> write.y() <= 75));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void erodeStiltResolvesItsOwnSampledAnchor() {
|
||||
RecordingPlacer placer = new RecordingPlacer(null);
|
||||
IrisObjectPlacement config = placement();
|
||||
config.setMode(ObjectPlaceMode.ERODE_STILT);
|
||||
assertEquals(ANCHOR_Y, lineObject(1).place(0, -1, 0, placer, config, new RNG(2L), data));
|
||||
assertFalse(placer.writes().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void explicitMinimumHeightAndFloatingDoNotNeedTerrainSampling() {
|
||||
for (ObjectPlaceMode mode : List.of(ObjectPlaceMode.MIN_HEIGHT, ObjectPlaceMode.FAST_MIN_HEIGHT,
|
||||
|
||||
@@ -63,7 +63,7 @@ public class ObjectPlacementGoldenTest {
|
||||
|
||||
private static final int OBJECTS = 200;
|
||||
private static final int SEEDS = 5;
|
||||
private static final long GOLDEN = 0x408f9d4113015897L;
|
||||
private static final long GOLDEN = 0x07dedb3d00b420c0L;
|
||||
private static final long MARKER_GOLDEN = 0x60b4bbf1144b239cL;
|
||||
private static final long HIGH_VARIANT_GOLDEN = 0xf017622340ecac42L;
|
||||
|
||||
|
||||
Reference in new issue
Block a user