public float[] GetHeights(int xstart, int zstart) { int size = chunkSize; height = size - 1; width = size - 1; heights = new float[size * size]; biomes = new Biome[heights.Length]; vertexArray = new Vertex[heights.Length]; indexArray = new int[width * height * 6]; for (int xx = 0; xx < size; xx++) { for (int yy = 0; yy < size; yy++) { float _x = yy + ((int)x * (size - 1)); float _y = xx + ((int)z * (size - 1)); float biomeHeight = 1f, temperature = 1f; int heightIndex = HeightIndexAt(yy, xx); float terrainHeight; if (this.generateBiomes) { biomeHeight = (float)(parent.getSimplexNoise(((double)_y * 0.6), ((double)_x * 0.6))); temperature = (float)(parent.getSimplexNoise(((double)_y), ((double)_x))); terrainHeight = (float)parent.getSimplexNoise(_x, _y); float mountainHeight = (float)parent.getNoise(_x * 0.05f, _y * 0.05f) * parent.GetWorleyNoise(_x * 0.008f, _y * 0.008f); Biome biome = new Biome(); biome.AverageTemperature = temperature; if (biomeHeight < 0.3f) { biome.Topography = Biome.BiomeTopography.Plains; } else { biome.Topography = Biome.BiomeTopography.Hills; } biomeHeight = (float)System.Math.Abs(biomeHeight) * 2; biomeHeight *= biomeHeight; biomes[heightIndex] = biome; heights[heightIndex] = MathUtil.Lerp(terrainHeight * 10, mountainHeight * 150f, MathUtil.Clamp(biomeHeight, 0.0f, 1.0f)); } else { terrainHeight = (float)parent.getNoise(_x, _y); heights[heightIndex] = terrainHeight * 25f; } } } return(heights); }