// Generated by scripts/generate.mjs from bindings/api.mjs. Do not edit.

///|
#external
pub type GLTFLoaderPlugin

///|
#module("@mizchi/three-mbt/gltf-plugins")
pub extern "js" fn GLTFLoaderPlugin::GLTFLoaderPlugin(
  name : String,
) -> GLTFLoaderPlugin = "gLTFLoaderPlugin"

///|
pub extern "js" fn GLTFLoaderPlugin::name(self : GLTFLoaderPlugin) -> String =
  #| (self) => self.name

///|
pub extern "js" fn GLTFLoaderPlugin::set_before_root(
  self : GLTFLoaderPlugin,
  callback : () -> Unit,
) -> Unit =
  #| (self, callback) => { self.beforeRoot=callback; }

///|
pub extern "js" fn GLTFLoaderPlugin::set_after_root(
  self : GLTFLoaderPlugin,
  callback : (GLTF) -> Unit,
) -> Unit =
  #| (self, callback) => { self.afterRoot=callback; }

///|
pub extern "js" fn GLTFLoaderPlugin::set_before_root_async(
  self : GLTFLoaderPlugin,
  callback : () -> @js_async.Promise[Unit],
) -> Unit =
  #| (self, callback) => { self.beforeRoot=callback; }

///|
pub extern "js" fn GLTFLoaderPlugin::set_after_root_async(
  self : GLTFLoaderPlugin,
  callback : (GLTF) -> @js_async.Promise[Unit],
) -> Unit =
  #| (self, callback) => { self.afterRoot=callback; }

///|
pub extern "js" fn GLTFLoaderPlugin::set_load_node(
  self : GLTFLoaderPlugin,
  matches : (Int) -> Bool,
  callback : (Int) -> @js_async.Promise[Object3D],
) -> Unit =
  #| (self, matches, callback) => { self.loadNode=index=>matches(index)?callback(index):null; }

///|
pub extern "js" fn GLTFLoaderPlugin::set_load_mesh(
  self : GLTFLoaderPlugin,
  matches : (Int) -> Bool,
  callback : (Int) -> @js_async.Promise[Object3D],
) -> Unit =
  #| (self, matches, callback) => { self.loadMesh=index=>matches(index)?callback(index):null; }

///|
pub extern "js" fn GLTFLoaderPlugin::set_load_material(
  self : GLTFLoaderPlugin,
  matches : (Int) -> Bool,
  callback : (Int) -> @js_async.Promise[Material],
) -> Unit =
  #| (self, matches, callback) => { self.loadMaterial=index=>matches(index)?callback(index):null; }

///|
pub extern "js" fn GLTFLoaderPlugin::set_load_texture(
  self : GLTFLoaderPlugin,
  matches : (Int) -> Bool,
  callback : (Int) -> @js_async.Promise[Texture],
) -> Unit =
  #| (self, matches, callback) => { self.loadTexture=index=>matches(index)?callback(index):null; }

///|
pub extern "js" fn GLTFLoaderPlugin::set_load_attachment(
  self : GLTFLoaderPlugin,
  matches : (Int) -> Bool,
  callback : (Int) -> @js_async.Promise[Object3D],
) -> Unit =
  #| (self, matches, callback) => { self.createNodeAttachment=index=>matches(index)?callback(index):null; }

///|
pub extern "js" fn GLTFLoaderPlugin::set_load_buffer_view(
  self : GLTFLoaderPlugin,
  matches : (Int) -> Bool,
  callback : (Int) -> @js_async.Promise[Bytes],
) -> Unit =
  #| (self, matches, callback) => { self.loadBufferView=index=>matches(index)?callback(index).then(data=>data.buffer.slice(data.byteOffset,data.byteOffset+data.byteLength)):null; }