This commit is contained in:
dfsek
2021-12-14 11:01:28 -07:00
parent bf5e7f589d
commit 58acca3078
147 changed files with 414 additions and 479 deletions

View File

@@ -15,10 +15,10 @@ import com.dfsek.paralithic.functions.dynamic.Context;
import com.dfsek.paralithic.functions.dynamic.DynamicFunction;
import com.dfsek.paralithic.node.Statefulness;
import com.dfsek.terra.addons.noise.config.templates.FunctionTemplate;
import java.util.Map.Entry;
import com.dfsek.terra.addons.noise.config.templates.FunctionTemplate;
public class UserDefinedFunction implements DynamicFunction {
private final Expression expression;
@@ -42,7 +42,7 @@ public class UserDefinedFunction implements DynamicFunction {
FunctionTemplate nest = entry.getValue();
parser.registerFunction(id, newInstance(nest));
}
return new UserDefinedFunction(parser.parse(template.getFunction(), functionScope), template.getArgs().size());
}

View File

@@ -24,17 +24,17 @@ public class DomainWarpedSampler implements NoiseSampler {
@Override
public double noise(long seed, double x, double y) {
return function.noise(seed++,
x + warp.noise(seed++, x, y) * amplitude,
y + warp.noise(seed, x, y) * amplitude
x + warp.noise(seed++, x, y) * amplitude,
y + warp.noise(seed, x, y) * amplitude
);
}
@Override
public double noise(long seed, double x, double y, double z) {
return function.noise(seed++,
x + warp.noise(seed++, x, y, z) * amplitude,
y + warp.noise(seed++, x, y, z) * amplitude,
z + warp.noise(seed, x, y, z) * amplitude
x + warp.noise(seed++, x, y, z) * amplitude,
y + warp.noise(seed++, x, y, z) * amplitude,
z + warp.noise(seed, x, y, z) * amplitude
);
}
}

View File

@@ -18,7 +18,6 @@ public class GaborNoiseSampler extends NoiseFunction {
private double a = 0.1;
private double f0 = 0.625;
private double kernelRadius = (FastMath.sqrt(-FastMath.log(0.05) / Math.PI) / a);
private double impulsesPerKernel = 64d;
private double impulseDensity = (impulsesPerKernel / (Math.PI * kernelRadius * kernelRadius));
private double impulsesPerCell = impulseDensity * kernelRadius * kernelRadius;