fromArray2D static method

void fromArray2D(
  1. Float32List vertices,
  2. List<List<double>> src
)

Set the height of plane vertices from a 2D array of heightmap values.

Float32List vertices A 1D array containing the vertex Z-positions of the geometry representing the terrain. List<double> src A 2D array representing a heightmap to apply to the terrain.

Implementation

static void fromArray2D(Float32List vertices, List<List<double>> src) {
  for (int i = 0, xl = src.length; i < xl; i++) {
    for (int j = 0, yl = src[i].length; j < yl; j++) {
      vertices[j*xl + i] = src[i][j];
    }
  }
}