public override double Execute(double x, double y, double z, CallableNode flow) { var dx = flow.Call(Input, x + step, y, z) - flow.Call(Input, x - step, y, z); var dz = flow.Call(Input, x, y, z + step) - flow.Call(Input, x, y, z - step); return(Math.Abs(dx) + Math.Abs(dz)); }
protected override double ExecuteFilter(double x, double y, double z, CallableNode flow, double inputValue) { var v01 = UMath.Clamp(0, 1, UMath.InverseLerp(inMin, inMax, inputValue)); var vC = curve.Evaluate((float)v01); return(UMath.Lerp(outMin, outMax, vC)); }
public LerpFilter(CallableNode input, CallableNode maskInput, double intensity, double inMin, double inMax, double outMin, double outMax) : base(input, maskInput, intensity) { this.inMin = inMin; this.inMax = inMax; this.outMin = outMin; this.outMax = outMax; if (inMax < inMin + 0.001) { this.inMax = inMin + 0.001; } if (outMax < outMin + 0.001) { this.outMax = outMin + 0.001; } }
public override double Execute(double x, double y, double z, CallableNode flow) { var ix = (x - fromX) * voxel2PixelPosX; var iz = (z - fromZ) * voxel2PixelPosZ; var hx = Mathf.Clamp((int)ix, 0, width - 1); var hz = Mathf.Clamp((int)iz, 0, height - 1); if (hx < 0 || hz < 0 || hx >= width - 1 || hz >= height - 1) { return(0); } var h00 = heights[hx + width * hz]; var h01 = heights[hx + width * (hz + 1)]; var h10 = heights[(hx + 1) + width * hz]; var h11 = heights[(hx + 1) + width * (hz + 1)]; return(UMath.BilinearInterpolate(h00, h01, h10, h11, ix - hx, iz - hz)); }
public CurveFilter(CallableNode input, CallableNode maskInput, double intensity, AnimationCurve curve, double inMin, double inMax, double outMin, double outMax) : base(input, maskInput, intensity) { // Create a copy of the animation curve to avoid any concurrency issue this.curve = new AnimationCurve(curve.keys); this.inMin = inMin; this.inMax = inMax; this.outMin = outMin; this.outMax = outMax; if (inMax < inMin + 0.001) { this.inMax = inMin + 0.001; } if (outMax < outMin + 0.001) { this.outMax = outMin + 0.001; } }
public override double Execute(double x, double y, double z, CallableNode flow) { var altitude = baseAltitude + simplexAltitude.GetValue(x * frequencyAltitude, z * frequencyAltitude) * scaleAltitude; if (y < altitude - tunnelsHeight - HeightMargin || y > altitude + tunnelsHeight + HeightMargin) { return(-HeightMargin); } var network = Math.Min(ridgedMultiFractal.GetValue(x, z), 1.0 - (1.0 - threshold) * 0.333333); var tunnel = network - threshold; var sign = tunnel < 0 ? -1.0 : 1.0; tunnel = sign * Math.Sqrt(Math.Abs(tunnel)); return(tunnelsHeight * tunnel - Math.Abs(y - altitude) + scalePerturbation * simplexPerturbation.GetValue(x * frequencyPerturbation, y * frequencyPerturbation, z * frequencyPerturbation) + scaleMicroPerturbation * simplexPerturbation.GetValue(x * frequencyMicroPerturbation, y * frequencyMicroPerturbation, z * frequencyMicroPerturbation)); }
public MinCombiner(CallableNode right, CallableNode left) : base(right, left) { }
public ToSlopeTransformer(CallableNode input) : base(input) { }
protected override double ExecuteFilter(double x, double y, double z, CallableNode flow, double inputValue) { var v01 = UMath.InverseLerp(inMin, inMax, inputValue); return(UMath.Lerp(outMin, outMax, v01)); }
public ToHeightTransformer(CallableNode input, double scale) : base(input) { this.scale = scale; }
public ScaleBiasFilter(CallableNode input, CallableNode maskInput, double intensity, double scale, double bias) : base(input, maskInput, intensity) { this.scale = scale; this.bias = bias; }
public override double Execute(double x, double y, double z, CallableNode flow) { return(Math.Min(flow.Call(Right, x, y, z), flow.Call(Left, x, y, z))); }
protected override double ExecuteFilter(double x, double y, double z, CallableNode flow, double inputValue) { return(Math.Abs(inputValue)); }
public ClampFilter(CallableNode input, CallableNode maskInput, double intensity, double min, double max) : base(input, maskInput, intensity) { this.min = min; this.max = max; }
protected override double ExecuteFilter(double x, double y, double z, CallableNode flow, double inputValue) { return(UMath.Clamp(min, max, inputValue)); }
public SubCombiner(CallableNode right, CallableNode left, double inWeight) : base(right, left) { this.in1Weight = 1 - inWeight; this.in2Weight = inWeight; }
public override double Execute(double x, double y, double z, CallableNode flow) { return(flow.Call(Right, x, y, z) * in1Weight - flow.Call(Left, x, y, z) * in2Weight); }
protected override double ExecuteFilter(double x, double y, double z, CallableNode flow, double inputValue) { return(min < inputValue && inputValue < max ? 1 : 0); }
public AbsFilter(CallableNode input, CallableNode maskInput, double intensity) : base(input, maskInput, intensity) { }
public override double Execute(double x, double y, double z, CallableNode flow) { return(Math.Sqrt((x - originX) * (x - originX) + (z - originZ) * (z - originZ))); }
protected override double ExecuteFilter(double x, double y, double z, CallableNode flow, double inputValue) { return(inputValue * scale + bias); }
protected override double ExecuteFilter(double x, double y, double z, CallableNode flow, double inputValue) { return(Terrace(inputValue, width * flow.Call(widthInput, x, y, z))); }
public override double Execute(double x, double y, double z, CallableNode flow) { return(noise.GetValue(x * frequency, y * frequency, z * frequency) * scale); }
public TerraceFilter(CallableNode input, CallableNode maskInput, double intensity, CallableNode widthInput, double width) : base(input, maskInput, intensity) { this.width = width; this.widthInput = widthInput; }
public override double Execute(double x, double y, double z, CallableNode flow) { return(fastNoise.GetNoise(x, y, z) * scale); }
public override double Execute(double x, double y, double z, CallableNode flow) { return(y - flow.Call(Input, x, y, z) * scale); }