generateHeightmap method

dynamic generateHeightmap(
  1. dynamic dt_size
)

Implementation

generateHeightmap(dt_size) {
  var data_arr = new Float32List(dt_size * dt_size * 3);
  var length = dt_size * dt_size;

  for (var i = 0; i < length; i++) {
    var val = MathUtils.randFloat(0, 1);
    data_arr[i * 3 + 0] = val;
    data_arr[i * 3 + 1] = val;
    data_arr[i * 3 + 2] = val;
  }

  return new DataTexture(data_arr, dt_size, dt_size, RGBFormat, FloatType,
      null, null, null, null, null, null, null);
}