private _PerlinNoiseTextureSampler(int repeat, int octaves, float persistence, int randomSeed = 177) { if (repeat <= 0) { repeat = -1; // repetition is disabled } _Scale = repeat > 0 ? new SizeF(repeat, repeat) : new SizeF(1, 1); _Perlin = new Perlin_Tileable(randomSeed, repeat); _Depth = 0; _Octaves = octaves; _Persistence = persistence; }
private static void _FillPerlinNoise(this Image <HalfSingle> image, float scale = 16, int repeat = 0, int octaves = 8, double persistence = 0.1f, int randomSeed = 177) { var generator = new Perlin_Tileable(randomSeed, repeat); for (int y = 0; y < image.Height; ++y) { for (int x = 0; x < image.Width; ++x) { var xx = (float)x / scale; var yy = (float)y / scale; var p = (float)generator.OctavePerlin(xx, yy, 0, octaves, persistence); var pp = new HalfSingle(p); image[x, y] = pp; } } image._MutateAutoLevels(); }