private void LoadFromRandomNoise(int Size, bool isVoronoi) { DiamondSquare diamondSquare = new DiamondSquare(Size); diamondSquare.Execute(); Voronoi vornoi = new Voronoi(Size, 20); if (isVoronoi) { vornoi.Execute(); } Width = Size; Height = Size; heights = new float[Size, Size]; Vertices = new Vbo[Width * Height]; for (int i = 0; i < Width; i++) { for (int j = 0; j < Height; j++) { if (isVoronoi) { heights[i, j] = (int)(((diamondSquare.Array[i, j] + 1) * 255) + vornoi.Array[i, j]) / 2; } else { heights[i, j] = (int)((diamondSquare.Array[i, j] + 1) * 255); } } } }