Cache 2D noise results to increase performance, update to latest Gaea

This commit is contained in:
dfsek
2020-10-31 15:46:09 -07:00
parent 89bc05fde8
commit be70ffa1b4
21 changed files with 51 additions and 26 deletions

View File

@@ -18,7 +18,7 @@ public class CoordinatePerturb {
* @param amplitude Offset amplitude
* @param seed Noise seed
*/
public CoordinatePerturb(float frequency, int amplitude, long seed) {
public CoordinatePerturb(double frequency, int amplitude, long seed) {
perturbX = new FastNoiseLite((int) seed);
perturbX.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
perturbX.setFrequency(frequency);

View File

@@ -9,7 +9,7 @@ public class ErosionNoise {
private final double thresh;
private final FastNoiseLite noise;
public ErosionNoise(float freq1, double thresh, int octaves, long seed) {
public ErosionNoise(double freq1, double thresh, int octaves, long seed) {
FastNoiseLite main = new FastNoiseLite((int) (seed + 1));
main.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
main.setFractalType(FastNoiseLite.FractalType.FBm);

View File

@@ -20,7 +20,7 @@ public class TerraBiomeGrid extends BiomeGrid {
private final BiomeZone zone;
public TerraBiomeGrid(World w, float freq1, float freq2, BiomeZone zone, ConfigPack c, UserDefinedGrid erosion) {
public TerraBiomeGrid(World w, double freq1, double freq2, BiomeZone zone, ConfigPack c, UserDefinedGrid erosion) {
super(w, freq1, freq2, 0, 0);
if(c.biomeBlend) {
perturb = new CoordinatePerturb(c.blendFreq, c.blendAmp, w.getSeed());

View File

@@ -15,7 +15,7 @@ public class UserDefinedGrid extends BiomeGrid {
private final ImageLoader.Channel channelX;
private final ImageLoader.Channel channelZ;
public UserDefinedGrid(World w, float freq1, float freq2, UserDefinedBiome[][] b, WorldConfig c) {
public UserDefinedGrid(World w, double freq1, double freq2, UserDefinedBiome[][] b, WorldConfig c) {
super(w, freq1, freq2, b.length, b[0].length);
super.setGrid(b);
imageLoader = c.imageLoader;