LibNoise.Generator.RiggedMultifractal.GetValue C# (CSharp) Method

GetValue() public method

Returns the output value for the given input coordinates.
public GetValue ( float x, float y, float z ) : float
x float The input coordinate on the x-axis.
y float The input coordinate on the y-axis.
z float The input coordinate on the z-axis.
return float
        public override float GetValue(float x, float y, float z)
        {
            x *= this.m_frequency;
            y *= this.m_frequency;
            z *= this.m_frequency;
            float signal = 0.0f;
            float value = 0.0f;
            float weight = 1.0f;
            float offset = 1.0f;
            float gain = 2.0f;
            for (int i = 0; i < this.m_octaveCount; i++)
            {
                float nx = Utils.MakeInt32Range(x);
                float ny = Utils.MakeInt32Range(y);
                float nz = Utils.MakeInt32Range(z);
                long seed = (this.m_seed + i) & 0x7fffffff;
                signal = Utils.GradientCoherentNoise3D(nx, ny, nz, seed, this.m_quality);
                signal = Mathf.Abs(signal);
                signal = offset - signal;
                signal *= signal;
                signal *= weight;
                weight = signal * gain;
                if (weight > 1.0f) { weight = 1.0f; }
                if (weight < 0.0f) { weight = 0.0f; }
                value += (signal * this.m_weights[i]);
                x *= this.m_lacunarity;
                y *= this.m_lacunarity;
                z *= this.m_lacunarity;
            }
            return (value * 1.25f) - 1.0f;
        }