Compiled scalar group heights

- Layer and generator programs sample single points through NoiseProgram.sample2D
- Scalar interpolator group means use the compiled programs when the seed matches
- Single-point program heights are property-tested against the generator path
This commit is contained in:
Brian Neumann-Fopiano committed 2026-10-21 23:57:11 -04:00
1 parent fa996a2e24
commit a25233edbc
5 files changed
+180 -2

No files matched your search

@@ -39,6 +39,26 @@ public class GeneratorProgramParityTest {
}
}
@Test
public void singlePointProgramHeightsMatchScalarHeightsBitForBit() {
SplittableRandom random = new SplittableRandom(0xFEEDL);
TerrainBatchScratch scratch = new TerrainBatchScratch();
for (int generatorIndex = 0; generatorIndex < 160; generatorIndex++) {
long shapeSeed = random.nextLong();
IrisGenerator scalar = generator(new SplittableRandom(shapeSeed));
IrisGenerator compiled = generator(new SplittableRandom(shapeSeed));
long superSeed = random.nextLong();
GeneratorProgram program = compiled.compileProgram(superSeed);
for (int sample = 0; sample < 400; sample++) {
double x = coordinate(random);
double z = random.nextInt(5) == 0 ? x : coordinate(random);
assertEquals("generator " + generatorIndex + " point " + x + "," + z,
Double.doubleToRawLongBits(scalar.getHeight(x, z, superSeed)),
Double.doubleToRawLongBits(program.height(scratch, x, z)));
}
}
}
@Test
public void chunkGridsMatchScalarHeightsBitForBit() {
SplittableRandom random = new SplittableRandom(0xC0FFEEL);