// Generated by scripts/generate.mjs from bindings/api.mjs. Do not edit.
///|
#external
pub type Flow
///|
#module("@mizchi/three-mbt/modeling-edit")
pub extern "js" fn Flow::Flow(mesh : Mesh, curve_count : Int) -> Flow = "flow"
///|
pub extern "js" fn Flow::object(self : Flow) -> Mesh =
#| (self) => self.object3D
///|
pub extern "js" fn Flow::spline_texture(self : Flow) -> DataTexture =
#| (self) => self.splineTexture
///|
pub extern "js" fn Flow::uniforms(self : Flow) -> FlowUniforms =
#| (self) => self.uniforms
///|
extern "js" fn Flow::ffi_update_curve(
self : Flow,
index : Int,
curve : Curve3,
) -> JsResult[Unit] =
#| (self, index, curve) => { try { return { ok: true, value: (() => { if (index < 0 || index >= self.curveArray.length) throw new RangeError("Curve index out of range"); const length = curve.getLength(); if (!(length > 0) || !Number.isFinite(length)) throw new RangeError("Flow requires a finite, positive curve length"); self.updateCurve(index, curve); })() }; } catch (error) { return { ok: false, error: String(error) }; } }
///|
pub fn Flow::update_curve(
self : Flow,
index : Int,
curve : Curve3,
) -> Unit raise ModelingError {
match self.ffi_update_curve(index, curve).into_result() {
Ok(value) => value
Err(message) => raise ModelingError(message)
}
}
///|
pub extern "js" fn Flow::move_along_curve(self : Flow, amount : Double) -> Unit =
#| (self, amount) => self.moveAlongCurve(amount)
///|
extern "js" fn Flow::ffi_curve(self : Flow, index : Int) -> Nullable[Curve3] =
#| (self, index) => self.curveArray[index]
///|
pub fn Flow::curve(self : Flow, index : Int) -> Curve3? {
self.ffi_curve(index).to_option()
}
///|
extern "js" fn Flow::ffi_curve_length(
self : Flow,
index : Int,
) -> Nullable[Double] =
#| (self, index) => self.curveLengthArray[index]
///|
pub fn Flow::curve_length(self : Flow, index : Int) -> Double? {
self.ffi_curve_length(index).to_option()
}