loadBuffer method

dynamic loadBuffer(
  1. dynamic bufferIndex
)

Implementation

loadBuffer(bufferIndex) async {
  Map<String, dynamic> bufferDef = json["buffers"][bufferIndex];
  var loader = 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 extensions[gltfExtensions["KHR_BINARY_GLTF"]].body;
  }

  var options = this.options;

  var url = LoaderUtils.resolveURL(bufferDef["uri"], options["path"]);

  final res = await loader.loadAsync(url);

  return res;
}