loadBufferView2 method

dynamic loadBufferView2(
  1. dynamic bufferViewIndex
)

Implementation

loadBufferView2(bufferViewIndex) async {
  var bufferViewDef = json["bufferViews"][bufferViewIndex];
  var buffer = await getDependency('buffer', bufferViewDef["buffer"]);

  var byteLength = bufferViewDef["byteLength"] ?? 0;
  var byteOffset = bufferViewDef["byteOffset"] ?? 0;

  // use sublist(0) clone new list, if not when load texture decode image will fail ? and with no error, return null image

  if (buffer is Uint8List) {
    return Uint8List.view(buffer.buffer, byteOffset, byteLength).sublist(0).buffer;
  } else {
    return Uint8List.view(buffer, byteOffset, byteLength).sublist(0).buffer;
  }
}