Skip to content

Commit

Permalink
Fixup previous comit
Browse files Browse the repository at this point in the history
  • Loading branch information
duplexsystem committed Sep 23, 2024
1 parent ce320b0 commit f88f0a2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.dfsek.terra.addons.noise.samplers.noise.simplex.DerivativeFractal;


public class DerivativeFractalTemplate extends SamplerTemplate<DerivativeFractal> {
public class DerivativeFractalTemplate extends NoiseTemplate<DerivativeFractal> {

@Value("octaves")
@Default
Expand All @@ -21,12 +21,11 @@ public class DerivativeFractalTemplate extends SamplerTemplate<DerivativeFractal
@Default
private double lacunarity = 2.0;

@Value("frequency")
@Default
private double frequency = 0.02;

@Override
public DerivativeFractal get() {
return new DerivativeFractal(octaves, gain, lacunarity, frequency);
DerivativeFractal derivativeFractal = new DerivativeFractal(octaves, gain, lacunarity);
derivativeFractal.setFrequency(frequency);
derivativeFractal.setSalt(salt);
return derivativeFractal;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.dfsek.terra.api.noise.DerivativeNoiseSampler;


public class PseudoErosionTemplate extends SamplerTemplate<PseudoErosionSampler> {
public class PseudoErosionTemplate extends NoiseTemplate<PseudoErosionSampler> {

@Value("octaves")
@Default
Expand Down Expand Up @@ -63,8 +63,9 @@ public class PseudoErosionTemplate extends SamplerTemplate<PseudoErosionSampler>

@Override
public PseudoErosionSampler get() {
return new PseudoErosionSampler(octaves, gain, lacunarity,
slopeStrength, branchStrength, strength,
erosionFrequency, heightSampler, slopeMask, slopeMaskFull, slopeMaskNone, jitterModifier, averageErosionImpulses);
PseudoErosionSampler pseudoErosionSampler = new PseudoErosionSampler(octaves, lacunarity, gain, slopeStrength, branchStrength, strength, erosionFrequency, heightSampler, slopeMask, slopeMaskNone, slopeMaskFull, jitterModifier, averageErosionImpulses);
pseudoErosionSampler.setFrequency(frequency);
pseudoErosionSampler.setSalt(salt);
return pseudoErosionSampler;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ public static float fract(float x) {
return (x - (float) Math.floor(x));
}

public static double exp(double val) {
final long tmp = (long) (1512775 * val + 1072632447);
return Double.longBitsToDouble(tmp << 32);
}

public static float smoothstep(float edge0, float edge1, float x) {
// Scale, bias and saturate x to 0..1 range
x = clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f);
Expand Down Expand Up @@ -183,6 +178,6 @@ public double getNoiseRaw(long seed, double x, double y) {

@Override
public double getNoiseRaw(long seed, double x, double y, double z) {
return noise(seed, x, z);
return getNoiseRaw(seed, x, z);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ public class DerivativeFractal extends DerivativeNoiseFunction {
private final int heightOctaves;
private final double heightGain;
private final double heightLacunarity;
private final double frequency;

public DerivativeFractal(int octaves, double gain, double lacunarity, double frequency) {
public DerivativeFractal(int octaves, double gain, double lacunarity) {
this.heightOctaves = octaves;
this.heightGain = gain;
this.heightLacunarity = lacunarity;
this.frequency = frequency;
}

private static float[] baseNoise(float px, float py) {
Expand Down Expand Up @@ -75,8 +73,6 @@ public boolean isDifferentiable() {

@Override
public double[] noised(long seed, double x, double y) {
x *= frequency;
y *= frequency;
double[] out = { 0.0f, 0.0f, 0.0f };
float heightFreq = 1.0f;
float heightAmp = 1f;
Expand Down

0 comments on commit f88f0a2

Please sign in to comment.