mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Fail with column and generator details on non-finite terrain heights
A NaN or infinite generator bound or noise value otherwise spreads into height caches and interpolation. Averaging now throws at the first bad sample.
Upstream: 5a5e8a8dc
This commit is contained in:
1 parent
b9d8125180
commit
39e4015b44
2 files changed
+86
-1
No files matched your search
@@ -702,9 +702,19 @@ public class IrisComplex implements DataProvider {
|
||||
if (generators.length == 0) {
|
||||
return 0D;
|
||||
}
|
||||
if (!Double.isFinite(low) || !Double.isFinite(high)) {
|
||||
throw new IllegalStateException("Terrain generator bounds were not finite at " + x + "," + z
|
||||
+ " (generator=" + generators[0].getLoadKey() + ", bounds=" + low + ".." + high + ").");
|
||||
}
|
||||
double height = 0D;
|
||||
for (IrisGenerator generator : generators) {
|
||||
height += M.lerp(low, high, generator.getHeight(x, z, seed));
|
||||
double noise = generator.getHeight(x, z, seed);
|
||||
if (!Double.isFinite(noise)) {
|
||||
throw new IllegalStateException("Terrain generator noise was not finite at " + x + "," + z
|
||||
+ " (generator=" + generator.getLoadKey() + ", noise=" + noise
|
||||
+ ", bounds=" + low + ".." + high + ").");
|
||||
}
|
||||
height += M.lerp(low, high, noise);
|
||||
}
|
||||
return height / generators.length;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user