public static void BuildSimpleGrid(this IMeshBuilder meshBuilder, float cellWidth, float cellLength, int segmentCount, Func <int, int, float> heightFunc) { for (int i = 0; i < segmentCount; i++) { float z = cellLength * i; for (int j = 0; j < segmentCount; j++) { float x = cellWidth * j; Vector3 offset = new Vector3(x, heightFunc(j, i), z); meshBuilder.BuildQuad(offset, cellWidth, cellLength); } } }