loadBuffer method
dynamic
loadBuffer(
- dynamic bufferIndex
Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views @param {number} bufferIndex @return {Promise
Implementation
loadBuffer(bufferIndex) async {
Map<String, dynamic> bufferDef = this.json["buffers"][bufferIndex];
var loader = this.fileLoader;
if (bufferDef["type"] != null && bufferDef["type"] != 'arraybuffer') {
throw ('THREE.GLTFLoader: ${bufferDef["type"]} buffer type is not supported.');
}
// If present, GLB container is required to be the first buffer.
if (bufferDef["uri"] == null && bufferIndex == 0) {
return this.extensions[EXTENSIONS["KHR_BINARY_GLTF"]].body;
}
var options = this.options;
var _url = LoaderUtils.resolveURL(bufferDef["uri"], options["path"]);
final res = await loader.loadAsync(_url);
return res;
}