public bool[,] Generate(int sizeX, int sizeY, int nThreads, int seed) { bool[,] tiles = new bool[sizeX, sizeY]; Func <Vector3, float, float> sampler = (pos, scale) => NoiseAlgos3D.LinearNoise(pos * scale); float seedF = (float)seed; ThreadedRunner.Run(nThreads, sizeY, (startY, endY) => { for (int y = startY; y <= endY; ++y) { float yF = (float)y; for (int x = 0; x < sizeX; ++x) { float xF = (float)x; float val = Noise.Sample(new Vector3(xF, yF, seedF), sampler); val = Mathf.Pow(val, Exponent); tiles[x, y] = (val > Threshold); } } }); return(tiles); }
public BiomeTile[,] Generate(int sizeX, int sizeY, int nThreads, int seed) { BiomeTile[,] tiles = new BiomeTile[sizeX, sizeY]; Func <Vector3, float, float> sampler = (pos, scale) => NoiseAlgos3D.LinearNoise(pos * scale); float seedF = (float)seed; ThreadedRunner.Run(nThreads, sizeY, (startY, endY) => { for (int y = startY; y <= endY; ++y) { float yF = (float)y; for (int x = 0; x < sizeX; ++x) { float xF = (float)x; tiles[x, y] = new BiomeTile(); tiles[x, y].CaveSmoothness = Noise.Sample(new Vector3(xF, yF, seedF), sampler); } } }); return(tiles); }