mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-03 06:16:10 +00:00
Use ping-pong noise for erosion
This commit is contained in:
@@ -8,11 +8,11 @@ import org.polydev.gaea.math.FastNoiseLite;
|
||||
public class ErosionNoise {
|
||||
private final double thresh;
|
||||
private final FastNoiseLite noise;
|
||||
public ErosionNoise(float freq1, double thresh, int octaves, long seed) {
|
||||
public ErosionNoise(float freq1, double thresh, long seed) {
|
||||
FastNoiseLite main = new FastNoiseLite((int) (seed+1));
|
||||
main.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
||||
main.setFractalType(FastNoiseLite.FractalType.FBm);
|
||||
main.setFractalOctaves(octaves);
|
||||
main.setFractalType(FastNoiseLite.FractalType.PingPong);
|
||||
main.setFractalOctaves(1);
|
||||
main.setFrequency(freq1);
|
||||
this.thresh = thresh;
|
||||
this.noise = main;
|
||||
@@ -25,7 +25,6 @@ public class ErosionNoise {
|
||||
* @return Whether location is eroded
|
||||
*/
|
||||
boolean isEroded(int x, int z) {
|
||||
double abs = Math.pow(noise.getNoise(x, z), 2);
|
||||
return abs < thresh;
|
||||
return (noise.getNoise(x, z)+1)/2 <= thresh;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class TerraBiomeGrid extends BiomeGrid {
|
||||
}
|
||||
this.zone = zone;
|
||||
if(c.erosionEnable) {
|
||||
erode = new ErosionNoise(c.erosionFreq, c.erosionThresh, c.erosionOctaves, w.getSeed());
|
||||
erode = new ErosionNoise(c.erosionFreq, c.erosionThresh, w.getSeed());
|
||||
this.erosionGrid = erosion;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,6 @@ public class ConfigPack extends YamlConfiguration {
|
||||
|
||||
public final float erosionFreq;
|
||||
public final double erosionThresh;
|
||||
public final int erosionOctaves;
|
||||
public final boolean erosionEnable;
|
||||
public final String erosionName;
|
||||
|
||||
@@ -108,7 +107,6 @@ public class ConfigPack extends YamlConfiguration {
|
||||
erosionEnable = getBoolean("erode.enable", false);
|
||||
erosionFreq = (float) getDouble("erode.frequency", 0.01);
|
||||
erosionThresh = getDouble("erode.threshold", 0.04);
|
||||
erosionOctaves = getInt("erosion.octaves", 4);
|
||||
|
||||
octaves = getInt("noise.octaves", 4);
|
||||
frequency = (float) getDouble("noise.frequency", 1f/96);
|
||||
|
||||
Reference in New Issue
Block a user