mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-14 04:41:13 +00:00
rework image stuff
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.biome;
|
||||
|
||||
import com.dfsek.terra.api.math.noise.FastNoiseLite;
|
||||
import com.dfsek.terra.api.math.noise.samplers.FastNoiseLite;
|
||||
import com.dfsek.terra.api.world.biome.BiomeGrid;
|
||||
import com.dfsek.terra.api.world.biome.NormalizationUtil;
|
||||
import com.dfsek.terra.config.base.ConfigPack;
|
||||
@@ -42,7 +42,7 @@ public class BiomeZone {
|
||||
* @return BiomeGrid at coordinates.
|
||||
*/
|
||||
public BiomeGrid getGrid(int x, int z) {
|
||||
return grids[NormalizationUtil.normalize(useImage ? Objects.requireNonNull(imageLoader).getNoiseVal(x, z, channel) : noise.getNoise(x, z), grids.length, 4)];
|
||||
return grids[getNoise(x, z)];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ public class BiomeZone {
|
||||
* @return Normalized noise at coordinates
|
||||
*/
|
||||
public int getNoise(int x, int z) {
|
||||
return NormalizationUtil.normalize(useImage ? Objects.requireNonNull(imageLoader).getNoiseVal(x, z, channel) : noise.getNoise(x, z), grids.length, 4);
|
||||
return useImage ? Objects.requireNonNull(imageLoader).getNoiseVal(x, z, getSize() - 1, channel) : NormalizationUtil.normalize(noise.getNoise(x, z), grids.length, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,6 +73,6 @@ public class BiomeZone {
|
||||
* @return Raw noise at coordinates
|
||||
*/
|
||||
public double getRawNoise(int x, int z) {
|
||||
return useImage ? Objects.requireNonNull(imageLoader).getNoiseVal(x, z, channel) : noise.getNoise(x, z);
|
||||
return useImage ? Objects.requireNonNull(imageLoader).getNoiseVal(x, z, getSize() - 1, channel) : noise.getNoise(x, z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.dfsek.terra.biome.grid;
|
||||
import com.dfsek.terra.api.math.vector.Location;
|
||||
import com.dfsek.terra.api.world.biome.Biome;
|
||||
import com.dfsek.terra.api.world.biome.BiomeGrid;
|
||||
import com.dfsek.terra.api.world.biome.NormalizationUtil;
|
||||
import com.dfsek.terra.api.world.generation.GenerationPhase;
|
||||
import com.dfsek.terra.config.base.ConfigPack;
|
||||
import com.dfsek.terra.config.base.ConfigPackTemplate;
|
||||
@@ -28,9 +27,9 @@ public class UserDefinedGrid extends BiomeGrid {
|
||||
@Override
|
||||
public Biome getBiome(int x, int z, GenerationPhase phase) {
|
||||
if(fromImage) {
|
||||
double xi = imageLoader.getNoiseVal(x, z, channelX);
|
||||
double zi = imageLoader.getNoiseVal(x, z, channelZ);
|
||||
return super.getGrid()[NormalizationUtil.normalize(xi, getSizeX(), 4)][NormalizationUtil.normalize(zi, getSizeZ(), 4)];
|
||||
int xi = imageLoader.getNoiseVal(x, z, getSizeX() - 1, channelX);
|
||||
int zi = imageLoader.getNoiseVal(x, z, getSizeZ() - 1, channelZ);
|
||||
return super.getGrid()[xi][zi];
|
||||
}
|
||||
return super.getBiome(x, z, phase);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.biome.postprocessing;
|
||||
|
||||
import com.dfsek.terra.api.math.noise.FastNoiseLite;
|
||||
import com.dfsek.terra.api.math.noise.samplers.FastNoiseLite;
|
||||
import com.dfsek.terra.api.math.vector.Vector2;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.dfsek.terra.biome.postprocessing;
|
||||
|
||||
import com.dfsek.terra.api.math.noise.FastNoiseLite;
|
||||
import com.dfsek.terra.api.math.noise.samplers.FastNoiseLite;
|
||||
import com.dfsek.terra.api.math.noise.samplers.NoiseSampler;
|
||||
import net.jafama.FastMath;
|
||||
|
||||
/**
|
||||
@@ -8,7 +9,7 @@ import net.jafama.FastMath;
|
||||
*/
|
||||
public class ErosionNoise {
|
||||
private final double thresh;
|
||||
private final FastNoiseLite noise;
|
||||
private final NoiseSampler noise;
|
||||
|
||||
public ErosionNoise(double freq1, double thresh, int octaves, long seed) {
|
||||
FastNoiseLite main = new FastNoiseLite((int) (seed + 1));
|
||||
|
||||
Reference in New Issue
Block a user