Beispiel #1
0
        public override float GetNoise(float x, float y)
        {
            float n = noise.GetNoise(x, y);
            float g = n * grain;

            return(g - (int)g);
        }
Beispiel #2
0
        public override float GetNoise(float x, float y, float z)
        {
            float total    = 0;
            float maxValue = 0;
            float fr       = frequency;
            float ampl     = 1;

            for (int i = 0; i < octaves; i++)
            {
                total    += noise.GetNoise(x * fr, y * fr, z * fr) * ampl;
                maxValue += ampl;
                ampl     *= persistence;
                fr       *= 2;
            }
            return((total / maxValue) * amplitude);

            //  return noise.FractalBrownian2(x, y);
        }
        public Vector2 WarpVector(Vector2 input, Vector3 offset1, Vector3 offset2)
        {
            float q1 = source.GetNoise((input.x + offset1.x) * frequency, (input.y + offset1.z) * frequency);
            float q2 = source.GetNoise((input.x + offset2.x) * frequency, (input.y + offset2.z) * frequency);

            return(new Vector2((input.x + q1 * amplitude) * frequency, (input.y + q2 * amplitude) * frequency));
        }
 public override float GetNoise(float x, float y)
 {
     return(noise.GetNoise(x * GetFreq(frequency.x), y * GetFreq(frequency.y)) * amplitude);
 }