loadBufferView2 method
dynamic
loadBufferView2(
- dynamic bufferViewIndex
Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views @param {number} bufferViewIndex @return {Promise
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;
}
}