/** * @param min the minimum thickness for the layer * @param max the maximum thickness for the layer */ public MinMaxLayerThickness(int min, int max) { //TODO: make sure that layers at different heights have different noise super(seed -> new BrownianNoise(new SimplexNoise(seed), 2)); this.min = min; this.max = max; }
public float[] noise(Region3i region) { Region3i fullRegion = determineRequiredRegion(region); float[] keyData = getKeyValues(fullRegion); float[] fullData = mapExpand(keyData, fullRegion); return getSubset(fullData, fullRegion, region); }
public float[] noise(Rect2i region) { Rect2i fullRegion = determineRequiredRegion(region); float[] keyData = getKeyValues(fullRegion); float[] fullData = mapExpand(keyData, fullRegion); return getSubset(fullData, fullRegion, region); }
@Override public void setSeed(long seed) { // TODO: reduce the number of octaves in BrownianNoise mountainNoise = new SubSampledNoise(new BrownianNoise(new PerlinNoise(seed + 3)), new Vector2f(0.0002f, 0.0002f), 4); hillNoise = new SubSampledNoise(new BrownianNoise(new PerlinNoise(seed + 4)), new Vector2f(0.0008f, 0.0008f), 4); }
@Parameters(name = "{0}") public static Collection<Noise[]> data() { return Arrays.asList(new Noise[][]{ {new WhiteNoise(0xCAFE)}, {new DiscreteWhiteNoise(0xCAFE)}, {new SimplexNoise(0xCAFE)}, {new PerlinNoise(0xCAFE)}, {new BrownianNoise(new WhiteNoise(0xCAFE), 3)} }); }
public float[] noise(Rect2i region) { Rect2i fullRegion = determineRequiredRegion(region); float[] keyData = getKeyValues(fullRegion); float[] fullData = mapExpand(keyData, fullRegion); return getSubset(fullData, fullRegion, region); }
/** * @param x and integer value * @return a random, but deterministic float value in [-1..1] */ public float noise(int x) { float noise = intNoise(x); return noise / Integer.MAX_VALUE; }
/** * @param octaves the number of octaves used for computation */ public void setOctaves(int octaves) { this.octaves = octaves; updateWeights(); }
@Override public float noise(float x, float y) { return noise(x, y, 0); } }
/** * @param other other the noise to use as a basis * @param octaves the number of octaves to use */ public BrownianNoise(Noise other, int octaves) { this.other = other; setOctaves(octaves); }
/** * Initialize with 9 octaves - <b>this is insanely expensive, but backwards compatible</b> */ protected BrownianNoiseOld() { setOctaves(9); }
/** * @param octaves the number of octaves to use */ public BrownianNoise2D(Noise2D other, int octaves) { this(other); setOctaves(octaves); }
/** * @param octaves the number of octaves to use */ public BrownianNoise3D(Noise3D other, int octaves) { this(other); setOctaves(octaves); }
private void reload() { float realScale = config.scale * 0.01f; Vector2f scale = new Vector2f(realScale, realScale); BrownianNoise brown = new BrownianNoise(new PerlinNoise(seed + 6), config.octaves); humidityNoise = new SubSampledNoise(brown, scale, SAMPLE_RATE); }
public float[] noise(Region3i region) { Region3i fullRegion = determineRequiredRegion(region); float[] keyData = getKeyValues(fullRegion); float[] fullData = mapExpand(keyData, fullRegion); return getSubset(fullData, fullRegion, region); }
/** * Persistence is what makes the amplitude shrink. * More precisely the amplitude of octave i = lacunarity^(-persistence * i) * @param persistence the persistence to set */ public void setPersistence(double persistence) { this.persistence = persistence; updateWeights(); }
@Override public void setSeed(long seed) { oceanNoise = new SubSampledNoise(new BrownianNoise(new PerlinNoise(seed + 1), 8), new Vector2f(0.0009f, 0.0009f), SAMPLE_RATE); }
@Override public void setSeed(long seed) { riverNoise = new SubSampledNoise(new BrownianNoise(new PerlinNoise(seed + 2), 8), new Vector2f(0.0008f, 0.0008f), SAMPLE_RATE); }
@Override public void setSeed(long seed) { temperatureNoise = new SubSampledNoise(new BrownianNoise(new PerlinNoise(seed + 5), 8), new Vector2f(0.0005f, 0.0005f), SAMPLE_RATE); }
@Override public void setSeed(long seed) { BrownianNoise source = new BrownianNoise(new PerlinNoise(seed), 8); surfaceNoise = new SubSampledNoise(source, new Vector2f(0.004f, 0.004f), SAMPLE_RATE); }