From 84cd96ecf7748cfe82f7048542e6ca4123c65bc4 Mon Sep 17 00:00:00 2001 From: dfsek Date: Sun, 24 Dec 2023 01:53:05 -0700 Subject: [PATCH 1/3] fix BrownianMotionSampler lerp usage --- .../noise/samplers/noise/fractal/BrownianMotionSampler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/fractal/BrownianMotionSampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/fractal/BrownianMotionSampler.java index 64f4ede05..bc766c731 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/fractal/BrownianMotionSampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/fractal/BrownianMotionSampler.java @@ -24,7 +24,7 @@ public class BrownianMotionSampler extends FractalNoiseFunction { for(int i = 0; i < octaves; i++) { double noise = input.noise(seed++, x, y); sum += noise * amp; - amp *= MathUtil.lerp(1.0, Math.min(noise + 1, 2) * 0.5, weightedStrength); + amp *= MathUtil.lerp(weightedStrength, 1.0, Math.min(noise + 1, 2) * 0.5); x *= lacunarity; y *= lacunarity; @@ -42,7 +42,7 @@ public class BrownianMotionSampler extends FractalNoiseFunction { for(int i = 0; i < octaves; i++) { double noise = input.noise(seed++, x, y, z); sum += noise * amp; - amp *= MathUtil.lerp(1.0, (noise + 1) * 0.5, weightedStrength); + amp *= MathUtil.lerp(weightedStrength, 1.0, (noise + 1) * 0.5); x *= lacunarity; y *= lacunarity; From 3622003a39d71c9ae792e9fcd79a379117db740c Mon Sep 17 00:00:00 2001 From: dfsek Date: Sun, 24 Dec 2023 02:02:46 -0700 Subject: [PATCH 2/3] fix other lerp issues --- .../noise/fractal/PingPongSampler.java | 4 ++-- .../noise/fractal/RidgedFractalSampler.java | 4 ++-- .../samplers/noise/simplex/PerlinSampler.java | 20 +++++++++---------- .../samplers/noise/value/ValueSampler.java | 20 +++++++++---------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/fractal/PingPongSampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/fractal/PingPongSampler.java index 653484fa1..761a5deaa 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/fractal/PingPongSampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/fractal/PingPongSampler.java @@ -36,7 +36,7 @@ public class PingPongSampler extends FractalNoiseFunction { for(int i = 0; i < octaves; i++) { double noise = pingPong((input.noise(seed++, x, y) + 1) * pingPongStrength); sum += (noise - 0.5) * 2 * amp; - amp *= MathUtil.lerp(1.0, noise, weightedStrength); + amp *= MathUtil.lerp(weightedStrength, 1.0, noise); x *= lacunarity; y *= lacunarity; @@ -54,7 +54,7 @@ public class PingPongSampler extends FractalNoiseFunction { for(int i = 0; i < octaves; i++) { double noise = pingPong((input.noise(seed++, x, y, z) + 1) * pingPongStrength); sum += (noise - 0.5) * 2 * amp; - amp *= MathUtil.lerp(1.0, noise, weightedStrength); + amp *= MathUtil.lerp(weightedStrength, 1.0, noise); x *= lacunarity; y *= lacunarity; diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/fractal/RidgedFractalSampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/fractal/RidgedFractalSampler.java index 9ebb20ba0..1b45ed820 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/fractal/RidgedFractalSampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/fractal/RidgedFractalSampler.java @@ -25,7 +25,7 @@ public class RidgedFractalSampler extends FractalNoiseFunction { for(int i = 0; i < octaves; i++) { double noise = Math.abs(input.noise(seed++, x, y)); sum += (noise * -2 + 1) * amp; - amp *= MathUtil.lerp(1.0, 1 - noise, weightedStrength); + amp *= MathUtil.lerp(weightedStrength, 1.0, 1 - noise); x *= lacunarity; y *= lacunarity; @@ -43,7 +43,7 @@ public class RidgedFractalSampler extends FractalNoiseFunction { for(int i = 0; i < octaves; i++) { double noise = Math.abs(input.noise(seed++, x, y, z)); sum += (noise * -2 + 1) * amp; - amp *= MathUtil.lerp(1.0, 1 - noise, weightedStrength); + amp *= MathUtil.lerp(weightedStrength, 1.0, 1 - noise); x *= lacunarity; y *= lacunarity; diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PerlinSampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PerlinSampler.java index 46ca9af30..8ce0c19dc 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PerlinSampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PerlinSampler.java @@ -33,10 +33,10 @@ public class PerlinSampler extends SimplexStyleSampler { int x1 = x0 + PRIME_X; int y1 = y0 + PRIME_Y; - double xf0 = MathUtil.lerp(gradCoord(seed, x0, y0, xd0, yd0), gradCoord(seed, x1, y0, xd1, yd0), xs); - double xf1 = MathUtil.lerp(gradCoord(seed, x0, y1, xd0, yd1), gradCoord(seed, x1, y1, xd1, yd1), xs); + double xf0 = MathUtil.lerp(xs, gradCoord(seed, x0, y0, xd0, yd0), gradCoord(seed, x1, y0, xd1, yd0)); + double xf1 = MathUtil.lerp(xs, gradCoord(seed, x0, y1, xd0, yd1), gradCoord(seed, x1, y1, xd1, yd1)); - return MathUtil.lerp(xf0, xf1, ys) * 1.4247691104677813; + return MathUtil.lerp(ys, xf0, xf1) * 1.4247691104677813; } @Override @@ -64,14 +64,14 @@ public class PerlinSampler extends SimplexStyleSampler { int y1 = y0 + PRIME_Y; int z1 = z0 + PRIME_Z; - double xf00 = MathUtil.lerp(gradCoord(seed, x0, y0, z0, xd0, yd0, zd0), gradCoord(seed, x1, y0, z0, xd1, yd0, zd0), xs); - double xf10 = MathUtil.lerp(gradCoord(seed, x0, y1, z0, xd0, yd1, zd0), gradCoord(seed, x1, y1, z0, xd1, yd1, zd0), xs); - double xf01 = MathUtil.lerp(gradCoord(seed, x0, y0, z1, xd0, yd0, zd1), gradCoord(seed, x1, y0, z1, xd1, yd0, zd1), xs); - double xf11 = MathUtil.lerp(gradCoord(seed, x0, y1, z1, xd0, yd1, zd1), gradCoord(seed, x1, y1, z1, xd1, yd1, zd1), xs); + double xf00 = MathUtil.lerp(xs, gradCoord(seed, x0, y0, z0, xd0, yd0, zd0), gradCoord(seed, x1, y0, z0, xd1, yd0, zd0)); + double xf10 = MathUtil.lerp(xs, gradCoord(seed, x0, y1, z0, xd0, yd1, zd0), gradCoord(seed, x1, y1, z0, xd1, yd1, zd0)); + double xf01 = MathUtil.lerp(xs, gradCoord(seed, x0, y0, z1, xd0, yd0, zd1), gradCoord(seed, x1, y0, z1, xd1, yd0, zd1)); + double xf11 = MathUtil.lerp(xs, gradCoord(seed, x0, y1, z1, xd0, yd1, zd1), gradCoord(seed, x1, y1, z1, xd1, yd1, zd1)); - double yf0 = MathUtil.lerp(xf00, xf10, ys); - double yf1 = MathUtil.lerp(xf01, xf11, ys); + double yf0 = MathUtil.lerp(ys, xf00, xf10); + double yf1 = MathUtil.lerp(ys, xf01, xf11); - return MathUtil.lerp(yf0, yf1, zs) * 0.964921414852142333984375; + return MathUtil.lerp(zs, yf0, yf1) * 0.964921414852142333984375; } } diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/value/ValueSampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/value/ValueSampler.java index 09b0574cf..f0ce72403 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/value/ValueSampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/value/ValueSampler.java @@ -25,10 +25,10 @@ public class ValueSampler extends ValueStyleNoise { int x1 = x0 + PRIME_X; int y1 = y0 + PRIME_Y; - double xf0 = MathUtil.lerp(valCoord(seed, x0, y0), valCoord(seed, x1, y0), xs); - double xf1 = MathUtil.lerp(valCoord(seed, x0, y1), valCoord(seed, x1, y1), xs); + double xf0 = MathUtil.lerp(xs, valCoord(seed, x0, y0), valCoord(seed, x1, y0)); + double xf1 = MathUtil.lerp(xs, valCoord(seed, x0, y1), valCoord(seed, x1, y1)); - return MathUtil.lerp(xf0, xf1, ys); + return MathUtil.lerp(ys, xf0, xf1); } @Override @@ -49,14 +49,14 @@ public class ValueSampler extends ValueStyleNoise { int y1 = y0 + PRIME_Y; int z1 = z0 + PRIME_Z; - double xf00 = MathUtil.lerp(valCoord(seed, x0, y0, z0), valCoord(seed, x1, y0, z0), xs); - double xf10 = MathUtil.lerp(valCoord(seed, x0, y1, z0), valCoord(seed, x1, y1, z0), xs); - double xf01 = MathUtil.lerp(valCoord(seed, x0, y0, z1), valCoord(seed, x1, y0, z1), xs); - double xf11 = MathUtil.lerp(valCoord(seed, x0, y1, z1), valCoord(seed, x1, y1, z1), xs); + double xf00 = MathUtil.lerp(xs, valCoord(seed, x0, y0, z0), valCoord(seed, x1, y0, z0)); + double xf10 = MathUtil.lerp(xs, valCoord(seed, x0, y1, z0), valCoord(seed, x1, y1, z0)); + double xf01 = MathUtil.lerp(xs, valCoord(seed, x0, y0, z1), valCoord(seed, x1, y0, z1)); + double xf11 = MathUtil.lerp(xs, valCoord(seed, x0, y1, z1), valCoord(seed, x1, y1, z1)); - double yf0 = MathUtil.lerp(xf00, xf10, ys); - double yf1 = MathUtil.lerp(xf01, xf11, ys); + double yf0 = MathUtil.lerp(ys, xf00, xf10); + double yf1 = MathUtil.lerp(ys, xf01, xf11); - return MathUtil.lerp(yf0, yf1, zs); + return MathUtil.lerp(zs, yf0, yf1); } } From d8ba9e10164e642422295fdcbc911e422f40158d Mon Sep 17 00:00:00 2001 From: dfsek Date: Sun, 24 Dec 2023 02:06:11 -0700 Subject: [PATCH 3/3] bump version --- build.gradle.kts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0088d805e..6d51c74f8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,8 +1,8 @@ preRelease(true) -versionProjects(":common:api", version("6.4.2")) -versionProjects(":common:implementation", version("6.4.2")) -versionProjects(":platforms", version("6.4.2")) +versionProjects(":common:api", version("6.4.3")) +versionProjects(":common:implementation", version("6.4.3")) +versionProjects(":platforms", version("6.4.3")) allprojects {