// Generated by scripts/generate.mjs from bindings/api.mjs. Do not edit.
///|
#external
pub type PLYExporter
///|
#module("@mizchi/three-mbt/modeling-io")
pub extern "js" fn PLYExporter::PLYExporter() -> PLYExporter = "pLYExporter"
///|
extern "js" fn PLYExporter::ffi_export_ascii(
self : PLYExporter,
root : Object3D,
options : PLYExportOptions,
) -> JsResult[String] =
#| (self, root, options) => { try { return { ok: true, value: (() => { const result = self.parse(root, undefined, {...options, binary: false}); if (typeof result !== "string") throw new Error("PLY export failed"); return result; })() }; } catch (error) { return { ok: false, error: String(error) }; } }
///|
pub fn PLYExporter::export_ascii(
self : PLYExporter,
root : Object3D,
options : PLYExportOptions,
) -> String raise ExportError {
match self.ffi_export_ascii(root, options).into_result() {
Ok(value) => value
Err(message) => raise ExportError(message)
}
}
///|
extern "js" fn PLYExporter::ffi_export_binary(
self : PLYExporter,
root : Object3D,
options : PLYExportOptions,
) -> JsResult[Bytes] =
#| (self, root, options) => { try { return { ok: true, value: (() => { const result = self.parse(root, undefined, {...options, binary: true}); if (!(result instanceof ArrayBuffer)) throw new Error("PLY export failed"); return new Uint8Array(result); })() }; } catch (error) { return { ok: false, error: String(error) }; } }
///|
pub fn PLYExporter::export_binary(
self : PLYExporter,
root : Object3D,
options : PLYExportOptions,
) -> Bytes raise ExportError {
match self.ffi_export_binary(root, options).into_result() {
Ok(value) => value
Err(message) => raise ExportError(message)
}
}