generateHeightmap method

dynamic generateHeightmap(
  1. dynamic dtSize
)

Implementation

generateHeightmap(dtSize) {
  var dataArr = Float32List(dtSize * dtSize * 3);
  var length = dtSize * dtSize;

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

  return DataTexture(dataArr, dtSize, dtSize, RGBFormat, FloatType, null, null, null, null, null, null, null);
}