Optimization

This commit is contained in:
Daniel Mills
2020-09-02 21:06:01 -04:00
parent e6b59bc16d
commit 9aa6d1c0fc
19 changed files with 242 additions and 307 deletions

View File

@@ -27,13 +27,13 @@ public class CellGenerator
RNG rx = rng.nextParallelRNG(8735652);
int s = rx.nextInt();
fn = new FastNoise(s);
fn.SetNoiseType(FastNoise.NoiseType.Cellular);
fn.SetCellularReturnType(FastNoise.CellularReturnType.CellValue);
fn.SetCellularDistanceFunction(FastNoise.CellularDistanceFunction.Natural);
fn.setNoiseType(FastNoise.NoiseType.Cellular);
fn.setCellularReturnType(FastNoise.CellularReturnType.CellValue);
fn.setCellularDistanceFunction(FastNoise.CellularDistanceFunction.Natural);
fd = new FastNoise(s);
fd.SetNoiseType(FastNoise.NoiseType.Cellular);
fd.SetCellularReturnType(FastNoise.CellularReturnType.Distance2Sub);
fd.SetCellularDistanceFunction(FastNoise.CellularDistanceFunction.Natural);
fd.setNoiseType(FastNoise.NoiseType.Cellular);
fd.setCellularReturnType(FastNoise.CellularReturnType.Distance2Sub);
fd.setCellularDistanceFunction(FastNoise.CellularDistanceFunction.Natural);
}
public float getDistance(double x, double z)

View File

@@ -7,9 +7,9 @@ public class CellHeightNoise implements NoiseGenerator {
public CellHeightNoise(long seed) {
this.n = new FastNoise((int) seed);
n.SetNoiseType(FastNoise.NoiseType.Cellular);
n.SetCellularReturnType(FastNoise.CellularReturnType.Distance2Sub);
n.SetCellularDistanceFunction(FastNoise.CellularDistanceFunction.Natural);
n.setNoiseType(FastNoise.NoiseType.Cellular);
n.setCellularReturnType(FastNoise.CellularReturnType.Distance2Sub);
n.setCellularDistanceFunction(FastNoise.CellularDistanceFunction.Natural);
}
private double filter(double noise) {

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -8,8 +8,8 @@ public class FractalBillowPerlinNoise implements NoiseGenerator, OctaveNoise {
public FractalBillowPerlinNoise(long seed) {
this.n = new FastNoise(new RNG(seed).imax());
n.SetFractalOctaves(1);
n.SetFractalType(FractalType.Billow);
n.setFractalOctaves(1);
n.setFractalType(FractalType.Billow);
}
public double f(double v) {
@@ -33,6 +33,6 @@ public class FractalBillowPerlinNoise implements NoiseGenerator, OctaveNoise {
@Override
public void setOctaves(int o) {
n.SetFractalOctaves(o);
n.setFractalOctaves(o);
}
}

View File

@@ -8,8 +8,8 @@ public class FractalBillowSimplexNoise implements NoiseGenerator, OctaveNoise {
public FractalBillowSimplexNoise(long seed) {
this.n = new FastNoise(new RNG(seed).imax());
n.SetFractalOctaves(1);
n.SetFractalType(FractalType.Billow);
n.setFractalOctaves(1);
n.setFractalType(FractalType.Billow);
}
public double f(double v) {
@@ -33,6 +33,6 @@ public class FractalBillowSimplexNoise implements NoiseGenerator, OctaveNoise {
@Override
public void setOctaves(int o) {
n.SetFractalOctaves(o);
n.setFractalOctaves(o);
}
}

View File

@@ -7,7 +7,7 @@ public class FractalCubicNoise implements NoiseGenerator {
public FractalCubicNoise(long seed) {
this.n = new FastNoise((int) seed);
n.SetFractalType(FractalType.Billow);
n.setFractalType(FractalType.Billow);
}
private double f(double n) {

View File

@@ -8,8 +8,8 @@ public class FractalFBMSimplexNoise implements NoiseGenerator, OctaveNoise {
public FractalFBMSimplexNoise(long seed) {
this.n = new FastNoise(new RNG(seed).imax());
n.SetFractalOctaves(1);
n.SetFractalType(FractalType.FBM);
n.setFractalOctaves(1);
n.setFractalType(FractalType.FBM);
}
public double f(double v) {
@@ -33,6 +33,6 @@ public class FractalFBMSimplexNoise implements NoiseGenerator, OctaveNoise {
@Override
public void setOctaves(int o) {
n.SetFractalOctaves(o);
n.setFractalOctaves(o);
}
}

View File

@@ -8,8 +8,8 @@ public class FractalRigidMultiSimplexNoise implements NoiseGenerator, OctaveNois
public FractalRigidMultiSimplexNoise(long seed) {
this.n = new FastNoise(new RNG(seed).imax());
n.SetFractalOctaves(1);
n.SetFractalType(FractalType.RigidMulti);
n.setFractalOctaves(1);
n.setFractalType(FractalType.RigidMulti);
}
public double f(double v) {
@@ -33,6 +33,6 @@ public class FractalRigidMultiSimplexNoise implements NoiseGenerator, OctaveNois
@Override
public void setOctaves(int o) {
n.SetFractalOctaves(o);
n.setFractalOctaves(o);
}
}

View File

@@ -5,9 +5,9 @@ public class GlobNoise implements NoiseGenerator {
public GlobNoise(long seed) {
this.n = new FastNoise((int) seed);
n.SetNoiseType(FastNoise.NoiseType.Cellular);
n.SetCellularReturnType(FastNoise.CellularReturnType.Distance2Div);
n.SetCellularDistanceFunction(FastNoise.CellularDistanceFunction.Natural);
n.setNoiseType(FastNoise.NoiseType.Cellular);
n.setCellularReturnType(FastNoise.CellularReturnType.Distance2Div);
n.setCellularDistanceFunction(FastNoise.CellularDistanceFunction.Natural);
}
private double f(double n)

View File

@@ -8,7 +8,7 @@ public class PerlinNoise implements NoiseGenerator, OctaveNoise {
public PerlinNoise(long seed) {
this.n = new FastNoise(new RNG(seed).imax());
n.SetNoiseType(FastNoise.NoiseType.Perlin);
n.setNoiseType(FastNoise.NoiseType.Perlin);
octaves = 1;
}

View File

@@ -8,7 +8,7 @@ public class SimplexNoise implements NoiseGenerator, OctaveNoise {
public SimplexNoise(long seed) {
this.n = new FastNoise(new RNG(seed).imax());
n.SetNoiseType(FastNoise.NoiseType.Simplex);
n.setNoiseType(FastNoise.NoiseType.Simplex);
octaves = 1;
}

View File

@@ -7,9 +7,9 @@ public class VascularNoise implements NoiseGenerator {
public VascularNoise(long seed) {
this.n = new FastNoise((int) seed);
n.SetNoiseType(FastNoise.NoiseType.Cellular);
n.SetCellularReturnType(FastNoise.CellularReturnType.Distance2Sub);
n.SetCellularDistanceFunction(FastNoise.CellularDistanceFunction.Natural);
n.setNoiseType(FastNoise.NoiseType.Cellular);
n.setCellularReturnType(FastNoise.CellularReturnType.Distance2Sub);
n.setCellularDistanceFunction(FastNoise.CellularDistanceFunction.Natural);
}
private double filter(double noise) {