public void addLayer(int seed, double freq, double amp) { var l = new NoiseLayer { amp = amp, freq = freq, perm = new int[512] }; for (var i = 0; i < 256; i++) { var ii = (int)Math.Floor(seed + i - (Math.Floor((seed + i) / 256D) * 256)); l.perm[ii] = perm[i]; l.perm[255 + ii] = l.perm[ii]; } layers.Add(l); }
public void addLayer(int seed, double freq, double amp) { int s = (int)Math.Floor(seed - Math.Floor(seed / 256D) * 256); NoiseLayer l = new NoiseLayer(); l.amp = amp; l.freq = freq; l.perm = new int[512]; for (int i = 0; i < 256; i++) { int ii = (int)Math.Floor((seed + i) - Math.Floor((seed + i) / 256D) * 256); l.perm[ii] = this.perm[i]; l.perm[255 + ii] = l.perm[ii]; } this.layers.Add(l); }