コード例 #1
0
ファイル: Select.cs プロジェクト: bonomali/Ibasa
        public override double Evaluate(double x)
        {
            double controlValue = Control.Evaluate(x);

            if (controlValue < (LowerBound - EdgeFalloff))
            {
                return(Source0.Evaluate(x));
            }
            else if (controlValue < (LowerBound + EdgeFalloff))
            {
                double lowerCurve = LowerBound - EdgeFalloff;
                double upperCurve = LowerBound + EdgeFalloff;
                double alpha      = (controlValue - lowerCurve) / (upperCurve - lowerCurve);
                return(Functions.SmoothStep(
                           Source0.Evaluate(x), Source1.Evaluate(x), alpha));
            }
            else if (controlValue < (UpperBound - EdgeFalloff))
            {
                return(Source1.Evaluate(x));
            }
            else if (controlValue < (UpperBound + EdgeFalloff))
            {
                double lowerCurve = UpperBound - EdgeFalloff;
                double upperCurve = UpperBound + EdgeFalloff;
                double alpha      = (controlValue - lowerCurve) / (upperCurve - lowerCurve);
                return(Functions.SmoothStep(
                           Source1.Evaluate(x), Source0.Evaluate(x), alpha));
            }
            else
            {
                return(Source0.Evaluate(x));
            }
        }
コード例 #2
0
ファイル: Select.cs プロジェクト: bonomali/Ibasa
        public override double Evaluate(double x, double y)
        {
            double controlValue = Control.Evaluate(x, y);

            if (controlValue < (LowerBound - EdgeFalloff))
            {
                return(Source0.Evaluate(x, y));
            }
            else if (controlValue < (LowerBound + EdgeFalloff))
            {
                double lowerCurve = LowerBound - EdgeFalloff;
                double upperCurve = LowerBound + EdgeFalloff;
                double alpha      = (controlValue - lowerCurve) / (upperCurve - lowerCurve);
                return(Numerics.Functions.Lerp(
                           Source0.Evaluate(x, y), Source1.Evaluate(x, y), alpha));
            }
            else if (controlValue <= (UpperBound - EdgeFalloff))
            {
                return(Source1.Evaluate(x, y));
            }
            else if (controlValue <= (UpperBound + EdgeFalloff))
            {
                double lowerCurve = UpperBound - EdgeFalloff;
                double upperCurve = UpperBound + EdgeFalloff;
                double alpha      = (controlValue - lowerCurve) / (upperCurve - lowerCurve);
                return(Numerics.Functions.Lerp(
                           Source1.Evaluate(x, y), Source0.Evaluate(x, y), alpha));
            }
            else
            {
                return(Source0.Evaluate(x, y));
            }
        }
コード例 #3
0
ファイル: Select.cs プロジェクト: bonomali/Ibasa
        public override double Evaluate(double x, double y, double z, double w, double v, double u)
        {
            double controlValue = Control.Evaluate(x, y, z, w, v, u);

            if (controlValue < (LowerBound - EdgeFalloff))
            {
                return(Source0.Evaluate(x, y, z, w, v, u));
            }
            else if (controlValue < (LowerBound + EdgeFalloff))
            {
                double lowerCurve = LowerBound - EdgeFalloff;
                double upperCurve = LowerBound + EdgeFalloff;
                double alpha      = (controlValue - lowerCurve) / (upperCurve - lowerCurve);
                return(Numerics.Functions.SmoothStep(
                           Source0.Evaluate(x, y, z, w, v, u), Source1.Evaluate(x, y, z, w, v, u), alpha));
            }
            else if (controlValue < (UpperBound - EdgeFalloff))
            {
                return(Source1.Evaluate(x, y, z, w, v, u));
            }
            else if (controlValue < (UpperBound + EdgeFalloff))
            {
                double lowerCurve = UpperBound - EdgeFalloff;
                double upperCurve = UpperBound + EdgeFalloff;
                double alpha      = (controlValue - lowerCurve) / (upperCurve - lowerCurve);
                return(Numerics.Functions.SmoothStep(
                           Source1.Evaluate(x, y, z, w, v, u), Source0.Evaluate(x, y, z, w, v, u), alpha));
            }
            else
            {
                return(Source0.Evaluate(x, y, z, w, v, u));
            }
        }
コード例 #4
0
ファイル: SplitScaleBias.cs プロジェクト: ObsidianMC/Obsidian
    /// <summary>
    /// Retrieve noise value
    /// </summary>
    /// <param name="x"></param>
    /// <param name="y"></param>
    /// <param name="z"></param>
    /// <returns></returns>
    public override double GetValue(double x, double y, double z)
    {
        double val = Source0.GetValue(x, y, z);

        val *= val > Center ? AboveCenterScale : BelowCenterScale;
        return(val + Bias);
    }
コード例 #5
0
 /// <summary>
 /// Retrieve noise value
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="z"></param>
 /// <returns></returns>
 public override double GetValue(double x, double y, double z)
 {
     x = Left ? (int)Math.Floor(x) << Amount : (int)Math.Floor(x) >> Amount;
     y = Left ? (int)Math.Floor(y) << Amount : (int)Math.Floor(y) >> Amount;
     z = Left ? (int)Math.Floor(z) << Amount : (int)Math.Floor(z) >> Amount;
     return(Source0.GetValue(x, y, z));
 }
コード例 #6
0
ファイル: Blend.cs プロジェクト: ObsidianMC/Obsidian
    /// <summary>
    /// Perform blur.
    /// </summary>
    /// <param name="x"></param>
    /// <param name="y"></param>
    /// <param name="z"></param>
    /// <returns></returns>
    public override double GetValue(double x, double y, double z)
    {
        var    self     = Source0.GetValue(x, y, z);
        double distance = Distance;

        return((
                   self +
                   Source0.GetValue(x, y, z + distance) +
                   Source0.GetValue(x, y, z - distance) +
                   Source0.GetValue(x + distance, y, z) +
                   Source0.GetValue(x - distance, y, z)
                   ) / 5d);
    }
コード例 #7
0
ファイル: TransitionMap.cs プロジェクト: ObsidianMC/Obsidian
    /// <summary>
    /// Detect transitions in source map.
    /// </summary>
    /// <returns>Progressively higher values (-1 < value < 1) as source transitions starting at Distance.</returns>
    public override double GetValue(double x, double y, double z)
    {
        var    self     = Source0.GetValue(x, y, z);
        double distance = Distance;
        var    res      = (
            (Source0.GetValue(x, y, z + distance) == self ? -1d : 1d) +
            (Source0.GetValue(x, y, z - distance) == self ? -1d : 1d) +
            (Source0.GetValue(x + distance, y, z) == self ? -1d : 1d) +
            (Source0.GetValue(x - distance, y, z) == self ? -1d : 1d)

            ) / 4d; // Get average

        return(res);
    }
コード例 #8
0
ファイル: Zoom.cs プロジェクト: ObsidianMC/Obsidian
 public override double GetValue(double x, double y, double z)
 {
     return(Source0.GetValue(x / Amount, y / Amount, z / Amount));
 }
コード例 #9
0
 public override double GetValue(double x, double y, double z)
 {
     return(Source0.GetValue(x, y, z) > Center ? 1 : -1);
 }