heightmapArray static method

Float32List heightmapArray(
  1. void method(
    1. Float32List,
    2. TerrainOptions
    ),
  2. TerrainOptions options
)

Generate a 1D array containing random heightmap data.

This is like {@link Terrain.toHeightmap} except that instead of generating the js mesh and material information you can just get the height data.

Function method The method to use to generate the heightmap data. Works with function that would be an acceptable value for the heightmap option for the {link Terrain} function. TerrainOptions options The same as the options parameter for the {@link Terrain} function.

Implementation

static Float32List heightmapArray(void Function(Float32List,TerrainOptions) method, TerrainOptions options) {
  Float32List arr = Float32List.fromList(List.filled((options.xSegments+1)*(options.ySegments+1), 0));
  method(arr, options);
  clamp(arr, options);
  return arr;
}