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>
<groupId>com.volmit</groupId>
<artifactId>Iris</artifactId>
<version>1.1.12</version>
<version>1.2</version>
<name>Iris</name>
<properties>
<skip.copy>false</skip.copy>

View File

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