Fix cellular noise

This commit is contained in:
Daniel Mills 2021-01-01 23:27:33 -05:00
parent 9d634ba4d7
commit a6d6814f27
2 changed files with 9 additions and 9 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.volmit</groupId> <groupId>com.volmit</groupId>
<artifactId>Iris</artifactId> <artifactId>Iris</artifactId>
<version>1.1.12</version> <version>1.2</version>
<name>Iris</name> <name>Iris</name>
<properties> <properties>
<skip.copy>false</skip.copy> <skip.copy>false</skip.copy>

View File

@ -4,31 +4,31 @@ import com.volmit.iris.util.RNG;
public class CellularNoise implements NoiseGenerator public class CellularNoise implements NoiseGenerator
{ {
private final FastNoiseDouble n; private final FastNoise n;
public CellularNoise(long seed) public CellularNoise(long seed)
{ {
this.n = new FastNoiseDouble(new RNG(seed).lmax()); this.n = new FastNoise(new RNG(seed).imax());
n.setNoiseType(FastNoiseDouble.NoiseType.Cellular); n.SetNoiseType(FastNoise.NoiseType.Cellular);
n.setCellularReturnType(FastNoiseDouble.CellularReturnType.CellValue); n.SetCellularReturnType(FastNoise.CellularReturnType.CellValue);
n.setCellularDistanceFunction(FastNoiseDouble.CellularDistanceFunction.Natural); n.SetCellularDistanceFunction(FastNoise.CellularDistanceFunction.Natural);
} }
@Override @Override
public double noise(double x) public double noise(double x)
{ {
return (n.GetCellular(x, 0) / 2D) + 0.5D; return (n.GetCellular((float) x, 0) / 2D) + 0.5D;
} }
@Override @Override
public double noise(double x, double z) public double noise(double x, double z)
{ {
return (n.GetCellular(x, z) / 2D) + 0.5D; return (n.GetCellular((float)x, (float)z) / 2D) + 0.5D;
} }
@Override @Override
public double noise(double x, double y, double z) public double noise(double x, double y, double z)
{ {
return (n.GetCellular(x, y, z) / 2D) + 0.5D; return (n.GetCellular((float)x, (float)y, (float)z) / 2D) + 0.5D;
} }
} }