mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-05 07:16:10 +00:00
fractal noise meta
This commit is contained in:
@@ -6,11 +6,11 @@ import com.dfsek.terra.api.math.noise.samplers.noise.fractal.BrownianMotionSampl
|
||||
public class BrownianMotionTemplate extends FractalTemplate<BrownianMotionSampler> {
|
||||
@Override
|
||||
public NoiseSampler apply(Long seed) {
|
||||
BrownianMotionSampler sampler = new BrownianMotionSampler((int) (long) seed, function.apply(seed));
|
||||
sampler.setGain(fractalGain);
|
||||
sampler.setLacunarity(fractalLacunarity);
|
||||
sampler.setOctaves(octaves);
|
||||
sampler.setWeightedStrength(weightedStrength);
|
||||
BrownianMotionSampler sampler = new BrownianMotionSampler((int) (long) seed, function.get().apply(seed));
|
||||
sampler.setGain(fractalGain.get());
|
||||
sampler.setLacunarity(fractalLacunarity.get());
|
||||
sampler.setOctaves(octaves.get());
|
||||
sampler.setWeightedStrength(weightedStrength.get());
|
||||
return sampler;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.dfsek.terra.config.loaders.config.sampler.templates.noise.fractal;
|
||||
|
||||
import com.dfsek.tectonic.annotations.Default;
|
||||
import com.dfsek.tectonic.annotations.Value;
|
||||
import com.dfsek.terra.api.config.meta.MetaValue;
|
||||
import com.dfsek.terra.api.math.noise.samplers.noise.fractal.FractalNoiseFunction;
|
||||
import com.dfsek.terra.api.util.seeded.NoiseSeeded;
|
||||
import com.dfsek.terra.config.loaders.config.sampler.templates.SamplerTemplate;
|
||||
@@ -9,20 +10,20 @@ import com.dfsek.terra.config.loaders.config.sampler.templates.SamplerTemplate;
|
||||
public abstract class FractalTemplate<T extends FractalNoiseFunction> extends SamplerTemplate<T> {
|
||||
@Value("octaves")
|
||||
@Default
|
||||
protected int octaves = 3;
|
||||
protected MetaValue<Integer> octaves = MetaValue.of(3);
|
||||
|
||||
@Value("gain")
|
||||
@Default
|
||||
protected double fractalGain = 0.5D;
|
||||
protected MetaValue<Double> fractalGain = MetaValue.of(0.5D);
|
||||
|
||||
@Value("lacunarity")
|
||||
@Default
|
||||
protected double fractalLacunarity = 2.0D;
|
||||
protected MetaValue<Double> fractalLacunarity = MetaValue.of(2.0D);
|
||||
|
||||
@Value("weighted-strength")
|
||||
@Default
|
||||
protected double weightedStrength = 0.0D;
|
||||
protected MetaValue<Double> weightedStrength = MetaValue.of(0.0D);
|
||||
|
||||
@Value("function")
|
||||
protected NoiseSeeded function;
|
||||
protected MetaValue<NoiseSeeded> function;
|
||||
}
|
||||
|
||||
@@ -12,11 +12,11 @@ public class PingPongTemplate extends FractalTemplate<PingPongSampler> {
|
||||
|
||||
@Override
|
||||
public NoiseSampler apply(Long seed) {
|
||||
PingPongSampler sampler = new PingPongSampler((int) (long) seed, function.apply(seed));
|
||||
sampler.setGain(fractalGain);
|
||||
sampler.setLacunarity(fractalLacunarity);
|
||||
sampler.setOctaves(octaves);
|
||||
sampler.setWeightedStrength(weightedStrength);
|
||||
PingPongSampler sampler = new PingPongSampler((int) (long) seed, function.get().apply(seed));
|
||||
sampler.setGain(fractalGain.get());
|
||||
sampler.setLacunarity(fractalLacunarity.get());
|
||||
sampler.setOctaves(octaves.get());
|
||||
sampler.setWeightedStrength(weightedStrength.get());
|
||||
sampler.setPingPongStrength(pingPong);
|
||||
return sampler;
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ import com.dfsek.terra.api.math.noise.samplers.noise.fractal.RidgedFractalSample
|
||||
public class RidgedFractalTemplate extends FractalTemplate<RidgedFractalSampler> {
|
||||
@Override
|
||||
public NoiseSampler apply(Long seed) {
|
||||
RidgedFractalSampler sampler = new RidgedFractalSampler((int) (long) seed, function.apply(seed));
|
||||
sampler.setGain(fractalGain);
|
||||
sampler.setLacunarity(fractalLacunarity);
|
||||
sampler.setOctaves(octaves);
|
||||
sampler.setWeightedStrength(weightedStrength);
|
||||
RidgedFractalSampler sampler = new RidgedFractalSampler((int) (long) seed, function.get().apply(seed));
|
||||
sampler.setGain(fractalGain.get());
|
||||
sampler.setLacunarity(fractalLacunarity.get());
|
||||
sampler.setOctaves(octaves.get());
|
||||
sampler.setWeightedStrength(weightedStrength.get());
|
||||
return sampler;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user