From 111eeeb435e0b5f84d16d6fe7480131fe3aae2db Mon Sep 17 00:00:00 2001 From: squid233 <513508220@qq.com> Date: Mon, 10 Oct 2022 13:39:15 +0800 Subject: [PATCH] 0.2.0 --- gradle.properties | 2 +- .../github/overrun/perlinoisej/PerlinNoise.java | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index ef98ff3..916af6c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Dfile.encoding=UTF-8 projGroupId=io.github.over-run projArtifactId=perlinoisej projName=perlinoisej -projVersion=0.1.0 +projVersion=0.2.0 projDesc=Java implementation for STB perlin noise projVcs=Over-Run/perlinoisej projBranch=0.x diff --git a/src/main/java/io/github/overrun/perlinoisej/PerlinNoise.java b/src/main/java/io/github/overrun/perlinoisej/PerlinNoise.java index 0a89d5b..2e21e9f 100644 --- a/src/main/java/io/github/overrun/perlinoisej/PerlinNoise.java +++ b/src/main/java/io/github/overrun/perlinoisej/PerlinNoise.java @@ -2,11 +2,11 @@ /** *
{@code float stb_perlin_noise3( float x, - * float y, - * float z, - * int x_wrap=0, - * int y_wrap=0, - * int z_wrap=0)}+ * float y, + * float z, + * int x_wrap=0, + * int y_wrap=0, + * int z_wrap=0)} *
* This function computes a random value at the coordinate (x,y,z).
* Adjacent random values are continuous but the noise fluctuates
@@ -206,8 +206,9 @@ private static float noise3internal(float x, float y, float z, int x_wrap, int y
z -= pz;
w = (((z * 6 - 15) * z + 10) * z * z * z);
- r0 = RANDTAB[x0 + seed] & 0xff;
- r1 = RANDTAB[x1 + seed] & 0xff;
+ int seed_i = seed & 0xff;
+ r0 = RANDTAB[x0 + seed_i] & 0xff;
+ r1 = RANDTAB[x1 + seed_i] & 0xff;
r00 = RANDTAB[r0 + y0] & 0xff;
r01 = RANDTAB[r0 + y1] & 0xff;