mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-01 15:36:45 +00:00
minor performance increase
This commit is contained in:
parent
e189b2389c
commit
4a1a6b80a6
@ -997,7 +997,12 @@ public class IrisInterpolation {
|
||||
return getNoise3D(method, x, y, z, rad, rad, rad, n);
|
||||
}
|
||||
|
||||
public static double getNoise(InterpolationMethod method, int x, int z, double h, NoiseProvider n) {
|
||||
private record Key(double x, double z) {}
|
||||
|
||||
public static double getNoise(InterpolationMethod method, int x, int z, double h, NoiseProvider noise) {
|
||||
HashMap<Key, Double> cache = new HashMap<>(64);
|
||||
NoiseProvider n = (x1, z1) -> cache.computeIfAbsent(new Key(x1, z1), k -> noise.noise(k.x, k.z));
|
||||
|
||||
if (method.equals(InterpolationMethod.BILINEAR)) {
|
||||
return getBilinearNoise(x, z, h, n);
|
||||
} else if (method.equals(InterpolationMethod.STARCAST_3)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user