mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-26 10:39:07 +00:00
Fix cellular noise
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user