Sign in

    moui_3d

    Experimental 3D scene and glTF viewer addon for MoUI

    moui
    3d
    gltf
    viewer
    Download zip
    Author
    Version
    0.2.1
    License
    Apache-2.0
    Last updated
    5 days ago
    Downloads
    13

    Dependencies

    #moui_3d

    Experimental, renderer-neutral 3D scene and glTF viewer primitives for MoUI.

    The first slice intentionally owns CPU scene data, camera controls, picking, and the external-surface binding contract. It does not add 3D variants to MoUI's 2D DrawCommand protocol.

    GltfResourceResolver

    type GltfResourceResolver = (String) -> Bytes?

    Resolves a URI referenced by a JSON .gltf document.

    GltfError

    pub(all) suberror GltfError {
    EmptyInput
    InvalidMagic
    UnsupportedVersion(Int)
    InvalidDeclaredLength
    TruncatedChunk
    MissingJsonChunk
    InvalidJson(String)
    UnsupportedAssetVersion(String)
    MissingBuffer(Int)
    MissingBufferView(Int)
    MissingAccessor(Int)
    MissingAttribute(String)
    InvalidAccessor(Int)
    UnsupportedComponentType(Int)
    UnsupportedAccessorType(String)
    UnsupportedPrimitiveMode(Int)
    UnsupportedExtension(String)
    UnsupportedRequiredExtension(String)
    ExternalResourceUnavailable(String)
    InvalidTexture(Int)
    InvalidSampler(Int)
    InvalidCamera(Int)
    InvalidScene(Int)
    InvalidSkin(Int)
    InvalidAnimation(Int)
    UnsupportedAnimationPath(String)
    InvalidNode(Int)
    InvalidNodeCycle(Int)
    } derive(Eq, ToJson,
    Debug
    )

    GltfError::equal

    fn GltfError::equal(GltfError, GltfError) -> Bool

    GltfError::not_equal

    fn GltfError::not_equal(x : GltfError, y : GltfError) -> Bool

    GltfError::to_json

    fn GltfError::to_json(GltfError) -> Json

    Aabb

    pub(all) struct Aabb {
    min : Vec3
    max : Vec3
    valid : Bool
    } derive(Eq, ToJson,
    Debug
    )

    Aabb::center

    fn Aabb::center(self : Aabb) -> Vec3

    Aabb::empty

    fn Aabb::empty() -> Aabb

    Aabb::equal

    fn Aabb::equal(Aabb, Aabb) -> Bool

    Aabb::extent

    fn Aabb::extent(self : Aabb) -> Vec3

    Aabb::from_points

    fn Aabb::from_points(points : Array[Vec3]) -> Aabb

    Aabb::include_point

    fn Aabb::include_point(self : Aabb, point : Vec3) -> Aabb

    Aabb::is_valid

    fn Aabb::is_valid(self : Aabb) -> Bool

    Aabb::max

    fn Aabb::max(self : Aabb) -> Vec3

    Aabb::min

    fn Aabb::min(self : Aabb) -> Vec3

    Aabb::not_equal

    fn Aabb::not_equal(x : Aabb, y : Aabb) -> Bool

    Aabb::radius

    fn Aabb::radius(self : Aabb) -> Double

    Aabb::to_json

    fn Aabb::to_json(Aabb) -> Json

    Aabb::to_repr

    Aabb::transformed

    fn Aabb::transformed(self : Aabb, matrix : Mat4) -> Aabb

    Aabb::union

    fn Aabb::union(self : Aabb, other : Aabb) -> Aabb

    AlphaMode

    pub(all) enum AlphaMode {
    Opaque
    Mask
    Blend
    } derive(Eq, ToJson,
    Debug
    )

    AlphaMode::equal

    fn AlphaMode::equal(AlphaMode, AlphaMode) -> Bool

    AlphaMode::not_equal

    fn AlphaMode::not_equal(x : AlphaMode, y : AlphaMode) -> Bool

    AlphaMode::to_json

    fn AlphaMode::to_json(AlphaMode) -> Json

    AnimationChannel

    pub(all) struct AnimationChannel {
    node : NodeId
    path : AnimationPath
    interpolation : AnimationInterpolation
    keyframes : Array[AnimationKeyframe]
    } derive(
    Debug
    )

    AnimationChannel::interpolation

    AnimationChannel::keyframes

    AnimationChannel::new

    fn AnimationChannel::new(node~ : NodeId, path~ : AnimationPath, interpolation~ : AnimationInterpolation, keyframes~ : Array[AnimationKeyframe]) -> AnimationChannel

    AnimationChannel::node

    AnimationChannel::path

    AnimationClip

    pub(all) struct AnimationClip {
    name : String
    channels : Array[AnimationChannel]
    duration : Double
    } derive(
    Debug
    )

    A named glTF animation clip. Channels are evaluated independently and can be blended or selected by the application without coupling the scene to a playback clock.

    AnimationClip::channels

    AnimationClip::duration

    fn AnimationClip::duration(self : AnimationClip) -> Double

    AnimationClip::name

    fn AnimationClip::name(self : AnimationClip) -> String

    AnimationClip::new

    fn AnimationClip::new(name? : String, channels~ : Array[AnimationChannel]) -> AnimationClip

    AnimationInterpolation

    pub(all) enum AnimationInterpolation {
    Step
    Linear
    CubicSpline
    } derive(Eq, ToJson,
    Debug
    )

    glTF animation interpolation modes supported by the CPU evaluator.

    AnimationInterpolation::equal

    AnimationInterpolation::not_equal

    AnimationInterpolation::to_json

    AnimationKeyframe

    pub(all) struct AnimationKeyframe {
    time : Double
    value : Array[Double]
    in_tangent : Array[Double]
    out_tangent : Array[Double]
    } derive(
    Debug
    )

    AnimationKeyframe::in_tangent

    fn AnimationKeyframe::in_tangent(self : AnimationKeyframe) -> Array[Double]

    AnimationKeyframe::new

    fn AnimationKeyframe::new(time~ : Double, value~ : Array[Double], in_tangent? : Array[Double], out_tangent? : Array[Double]) -> AnimationKeyframe

    AnimationKeyframe::out_tangent

    fn AnimationKeyframe::out_tangent(self : AnimationKeyframe) -> Array[Double]

    AnimationKeyframe::time

    fn AnimationKeyframe::time(self : AnimationKeyframe) -> Double

    AnimationKeyframe::value

    fn AnimationKeyframe::value(self : AnimationKeyframe) -> Array[Double]

    AnimationPath

    pub(all) enum AnimationPath {
    Translation
    Rotation
    Scale
    Weights
    } derive(Eq, ToJson,
    Debug
    )

    AnimationPath::equal

    AnimationPath::not_equal

    fn AnimationPath::not_equal(x : AnimationPath, y : AnimationPath) -> Bool

    AnimationPath::to_json

    AnimationPlayer

    pub struct AnimationPlayer {
    clip : AnimationClip?
    time : Double
    playing : Bool
    }

    CPU playback state for a selected clip. Applying samples to node TRS is intentionally left to the scene owner so renderers never own animation clocks or mutable scene state.

    AnimationPlayer::advance

    fn AnimationPlayer::advance(self : AnimationPlayer, delta_seconds : Double) -> Unit

    AnimationPlayer::clear_clip

    fn AnimationPlayer::clear_clip(self : AnimationPlayer) -> Unit

    AnimationPlayer::new

    AnimationPlayer::pause

    fn AnimationPlayer::pause(self : AnimationPlayer) -> Unit

    AnimationPlayer::play

    fn AnimationPlayer::play(self : AnimationPlayer) -> Unit

    AnimationPlayer::playing

    fn AnimationPlayer::playing(self : AnimationPlayer) -> Bool

    AnimationPlayer::sample

    AnimationPlayer::seek

    fn AnimationPlayer::seek(self : AnimationPlayer, time : Double) -> Unit

    AnimationPlayer::set_clip

    fn AnimationPlayer::set_clip(self : AnimationPlayer, clip : AnimationClip) -> Unit

    AnimationPlayer::time

    fn AnimationPlayer::time(self : AnimationPlayer) -> Double

    AnimationSample

    pub(all) struct AnimationSample {
    node : NodeId
    path : AnimationPath
    value : Array[Double]
    } derive(
    Debug
    )

    AnimationSample::new

    fn AnimationSample::new(node~ : NodeId, path~ : AnimationPath, value~ : Array[Double]) -> AnimationSample

    AnimationSample::node

    AnimationSample::path

    AnimationSample::value

    fn AnimationSample::value(self : AnimationSample) -> Array[Double]

    AssetByteSource

    pub(all) struct AssetByteSource {
    read_fn : (String) -> Bytes?
    }

    Platform-neutral byte source injected by an application or service layer. moui_3d never performs filesystem or network I/O itself.

    AssetByteSource::new

    fn AssetByteSource::new(read : (String) -> Bytes?) -> AssetByteSource

    AssetByteSource::read

    fn AssetByteSource::read(self : AssetByteSource, uri : String) -> Bytes?

    AssetLoadResult

    pub(all) enum AssetLoadResult {
    Bytes(Bytes)
    Missing(String)
    Invalid(String)
    } derive(
    Debug
    )

    Camera

    pub(all) struct Camera {
    name : String
    projection : CameraProjection
    } derive(Eq, ToJson,
    Debug
    )

    Camera::equal

    fn Camera::equal(Camera, Camera) -> Bool

    Camera::name

    fn Camera::name(self : Camera) -> String

    Camera::new

    fn Camera::new(name? : String, projection~ : CameraProjection) -> Camera

    Camera::not_equal

    fn Camera::not_equal(x : Camera, y : Camera) -> Bool

    Camera::projection

    fn Camera::projection(self : Camera) -> CameraProjection

    Camera::to_json

    fn Camera::to_json(Camera) -> Json

    Camera::to_repr

    CameraProjection

    pub(all) enum CameraProjection {
    Perspective(Double, Double, Double, Double)
    Orthographic(Double, Double, Double, Double)
    } derive(Eq, ToJson,
    Debug
    )

    CameraProjection::equal

    CameraProjection::not_equal

    fn CameraProjection::not_equal(x : CameraProjection, y : CameraProjection) -> Bool

    CameraProjection::to_json

    GltfDocument

    pub(all) struct GltfDocument {
    json : String
    binary : Bytes?
    mesh_count : Int
    node_count : Int
    material_count : Int
    texture_count : Int
    sampler_count : Int
    camera_count : Int
    scene_count : Int
    } derive(
    Debug
    )

    GltfDocument::binary

    fn GltfDocument::binary(self : GltfDocument) -> Bytes?

    GltfDocument::camera_count

    fn GltfDocument::camera_count(self : GltfDocument) -> Int

    GltfDocument::json

    fn GltfDocument::json(self : GltfDocument) -> String

    GltfDocument::material_count

    fn GltfDocument::material_count(self : GltfDocument) -> Int

    GltfDocument::mesh_count

    fn GltfDocument::mesh_count(self : GltfDocument) -> Int

    GltfDocument::node_count

    fn GltfDocument::node_count(self : GltfDocument) -> Int

    GltfDocument::sampler_count

    fn GltfDocument::sampler_count(self : GltfDocument) -> Int

    GltfDocument::scene_count

    fn GltfDocument::scene_count(self : GltfDocument) -> Int

    GltfDocument::texture_count

    fn GltfDocument::texture_count(self : GltfDocument) -> Int

    Mat4

    pub(all) struct Mat4 {
    values : Array[Double]
    } derive(
    Debug
    )

    Row-major 4x4 matrix. Translation occupies indices 3, 7 and 11.

    Mat4::at

    fn Mat4::at(self : Mat4, row : Int, column : Int) -> Double

    Mat4::from_values

    fn Mat4::from_values(values : Array[Double]) -> Mat4

    Mat4::identity

    fn Mat4::identity() -> Mat4

    Mat4::look_at

    fn Mat4::look_at(eye~ : Vec3, target~ : Vec3, up~ : Vec3) -> Mat4

    Mat4::mul

    fn Mat4::mul(self : Mat4, other : Mat4) -> Mat4

    Mat4::perspective

    fn Mat4::perspective(fov_y_radians~ : Double, aspect~ : Double, near~ : Double, far~ : Double) -> Mat4

    Mat4::scale_uniform

    fn Mat4::scale_uniform(amount : Double) -> Mat4

    Mat4::to_repr

    Mat4::transform_homogeneous

    fn Mat4::transform_homogeneous(self : Mat4, point : Vec3) -> Vec4

    Transform a point without performing the perspective divide. Renderers must use this form so clip-space w survives until the GPU vertex shader.

    Mat4::transform_point

    fn Mat4::transform_point(self : Mat4, point : Vec3) -> Vec3

    Mat4::transform_vec4

    fn Mat4::transform_vec4(self : Mat4, vector : Vec4) -> Vec4

    Transform an arbitrary homogeneous vector without a perspective divide.

    Mat4::translation

    fn Mat4::translation(offset : Vec3) -> Mat4

    Mat4::values

    fn Mat4::values(self : Mat4) -> Array[Double]

    Material

    pub(all) struct Material {
    base_color : Vec4
    metallic : Double
    roughness : Double
    base_color_texture : TextureId?
    normal_texture : TextureId?
    occlusion_texture : TextureId?
    emissive_texture : TextureId?
    emissive_factor : Vec3
    alpha_mode : AlphaMode
    alpha_cutoff : Double
    double_sided : Bool
    } derive(Eq, ToJson,
    Debug
    )

    Material::alpha_cutoff

    fn Material::alpha_cutoff(self : Material) -> Double

    Material::alpha_mode

    fn Material::alpha_mode(self : Material) -> AlphaMode

    Material::base_color

    fn Material::base_color(self : Material) -> Vec4

    Material::base_color_texture

    fn Material::base_color_texture(self : Material) -> TextureId?

    Material::double_sided

    fn Material::double_sided(self : Material) -> Bool

    Material::emissive_factor

    fn Material::emissive_factor(self : Material) -> Vec3

    Material::emissive_texture

    fn Material::emissive_texture(self : Material) -> TextureId?

    Material::equal

    fn Material::equal(Material, Material) -> Bool

    Material::metallic

    fn Material::metallic(self : Material) -> Double

    Material::normal_texture

    fn Material::normal_texture(self : Material) -> TextureId?

    Material::not_equal

    fn Material::not_equal(x : Material, y : Material) -> Bool

    Material::occlusion_texture

    fn Material::occlusion_texture(self : Material) -> TextureId?

    Material::pbr

    fn Material::pbr(base_color? : Vec4, metallic? : Double, roughness? : Double, base_color_texture? : TextureId?, normal_texture? : TextureId?, occlusion_texture? : TextureId?, emissive_texture? : TextureId?, emissive_factor? : Vec3, alpha_mode? : AlphaMode, alpha_cutoff? : Double, double_sided? : Bool) -> Material

    Material::roughness

    fn Material::roughness(self : Material) -> Double

    Material::to_json

    fn Material::to_json(Material) -> Json

    Material::to_repr

    MaterialId

    pub(all) struct MaterialId {
    value : Int
    } derive(Eq, ToJson,
    Debug
    )

    MaterialId::equal

    fn MaterialId::equal(MaterialId, MaterialId) -> Bool

    MaterialId::new

    fn MaterialId::new(value : Int) -> MaterialId

    MaterialId::not_equal

    fn MaterialId::not_equal(x : MaterialId, y : MaterialId) -> Bool

    MaterialId::to_json

    fn MaterialId::to_json(MaterialId) -> Json

    MaterialId::value

    fn MaterialId::value(self : MaterialId) -> Int

    Mesh

    pub(all) struct Mesh {
    name : String
    primitives : Array[Primitive]
    weights : Array[Double]
    bounds : Aabb
    } derive(
    Debug
    )

    Mesh::bounds

    fn Mesh::bounds(self : Mesh) -> Aabb

    Mesh::name

    fn Mesh::name(self : Mesh) -> String

    Mesh::new

    fn Mesh::new(name? : String, primitives~ : Array[Primitive], weights? : Array[Double]) -> Mesh

    Mesh::primitives

    fn Mesh::primitives(self : Mesh) -> Array[Primitive]

    Mesh::to_repr

    Mesh::weights

    fn Mesh::weights(self : Mesh) -> Array[Double]

    MeshId

    pub(all) struct MeshId {
    value : Int
    } derive(Eq, ToJson,
    Debug
    )

    MeshId::equal

    fn MeshId::equal(MeshId, MeshId) -> Bool

    MeshId::new

    fn MeshId::new(value : Int) -> MeshId

    MeshId::not_equal

    fn MeshId::not_equal(x : MeshId, y : MeshId) -> Bool

    MeshId::to_json

    fn MeshId::to_json(MeshId) -> Json

    MeshId::to_repr

    MeshId::value

    fn MeshId::value(self : MeshId) -> Int

    Node

    pub(all) struct Node {
    name : String
    parent : NodeId?
    children : Array[NodeId]
    local_transform : Mat4
    mesh : MeshId?
    camera : Int?
    skin : Int?
    weights : Array[Double]?
    } derive(
    Debug
    )

    Node::camera

    fn Node::camera(self : Node) -> Int?

    Node::children

    fn Node::children(self : Node) -> Array[NodeId]

    Node::local_transform

    fn Node::local_transform(self : Node) -> Mat4

    Node::mesh

    fn Node::mesh(self : Node) -> MeshId?

    Node::name

    fn Node::name(self : Node) -> String

    Node::new

    fn Node::new(name? : String, parent? : NodeId?, local_transform? : Mat4, mesh? : MeshId?, camera? : Int?, skin? : Int?, weights? : Array[Double]?) -> Node

    Node::parent

    fn Node::parent(self : Node) -> NodeId?

    Node::skin

    fn Node::skin(self : Node) -> Int?

    Node::to_repr

    Node::weights

    fn Node::weights(self : Node) -> Array[Double]?

    Node::with_child

    fn Node::with_child(self : Node, child : NodeId) -> Node

    Node::with_local_transform

    fn Node::with_local_transform(self : Node, local_transform : Mat4) -> Node

    Return a node with a replaced local transform. Scene animation applies poses to a copied scene so the authored/rest transform remains reusable.

    NodeId

    pub(all) struct NodeId {
    value : Int
    } derive(Eq, ToJson,
    Debug
    )

    NodeId::equal

    fn NodeId::equal(NodeId, NodeId) -> Bool

    NodeId::new

    fn NodeId::new(value : Int) -> NodeId

    NodeId::not_equal

    fn NodeId::not_equal(x : NodeId, y : NodeId) -> Bool

    NodeId::to_json

    fn NodeId::to_json(NodeId) -> Json

    NodeId::to_repr

    NodeId::value

    fn NodeId::value(self : NodeId) -> Int

    OrbitCamera

    pub(all) struct OrbitCamera {
    target : Vec3
    radius : Double
    azimuth : Double
    polar : Double
    perspective : PerspectiveCamera
    } derive(Eq, ToJson,
    Debug
    )

    Orbit camera state. polar is measured from the positive Y axis and is clamped away from the poles so orbiting cannot flip the view upside down.

    OrbitCamera::azimuth

    fn OrbitCamera::azimuth(self : OrbitCamera) -> Double

    OrbitCamera::equal

    fn OrbitCamera::equal(OrbitCamera, OrbitCamera) -> Bool

    OrbitCamera::fit

    fn OrbitCamera::fit(self : OrbitCamera, bounds : Aabb, padding? : Double) -> OrbitCamera

    OrbitCamera::new

    fn OrbitCamera::new(target? : Vec3, radius? : Double, azimuth? : Double, polar? : Double, perspective? : PerspectiveCamera) -> OrbitCamera

    OrbitCamera::not_equal

    fn OrbitCamera::not_equal(x : OrbitCamera, y : OrbitCamera) -> Bool

    OrbitCamera::orbit

    fn OrbitCamera::orbit(self : OrbitCamera, delta_azimuth : Double, delta_polar : Double) -> OrbitCamera

    OrbitCamera::pan

    fn OrbitCamera::pan(self : OrbitCamera, delta : Vec2) -> OrbitCamera

    OrbitCamera::perspective

    fn OrbitCamera::perspective(self : OrbitCamera) -> PerspectiveCamera

    OrbitCamera::polar

    fn OrbitCamera::polar(self : OrbitCamera) -> Double

    OrbitCamera::position

    fn OrbitCamera::position(self : OrbitCamera) -> Vec3

    OrbitCamera::projection

    fn OrbitCamera::projection(self : OrbitCamera) -> Mat4

    OrbitCamera::radius

    fn OrbitCamera::radius(self : OrbitCamera) -> Double

    OrbitCamera::ray_for_viewport

    fn OrbitCamera::ray_for_viewport(self : OrbitCamera, point : Vec2, viewport : Vec2) -> Ray

    Construct a world-space ray through a logical viewport point.

    OrbitCamera::target

    fn OrbitCamera::target(self : OrbitCamera) -> Vec3

    OrbitCamera::to_json

    fn OrbitCamera::to_json(OrbitCamera) -> Json

    OrbitCamera::view

    fn OrbitCamera::view(self : OrbitCamera) -> Mat4

    OrbitCamera::with_aspect

    fn OrbitCamera::with_aspect(self : OrbitCamera, aspect : Double) -> OrbitCamera

    OrbitCamera::zoom

    fn OrbitCamera::zoom(self : OrbitCamera, amount : Double) -> OrbitCamera

    PerspectiveCamera

    pub(all) struct PerspectiveCamera {
    fov_y_radians : Double
    aspect : Double
    near : Double
    far : Double
    } derive(Eq, ToJson,
    Debug
    )

    Perspective camera with the glTF-compatible Y-up, right-handed convention.

    PerspectiveCamera::equal

    PerspectiveCamera::far

    fn PerspectiveCamera::far(self : PerspectiveCamera) -> Double

    PerspectiveCamera::fov_y_radians

    fn PerspectiveCamera::fov_y_radians(self : PerspectiveCamera) -> Double

    PerspectiveCamera::near

    fn PerspectiveCamera::near(self : PerspectiveCamera) -> Double

    PerspectiveCamera::new

    fn PerspectiveCamera::new(fov_y_radians? : Double, aspect? : Double, near? : Double, far? : Double) -> PerspectiveCamera

    PerspectiveCamera::not_equal

    fn PerspectiveCamera::not_equal(x : PerspectiveCamera, y : PerspectiveCamera) -> Bool

    PerspectiveCamera::projection

    fn PerspectiveCamera::projection(self : PerspectiveCamera) -> Mat4

    PerspectiveCamera::to_json

    PerspectiveCamera::with_aspect

    fn PerspectiveCamera::with_aspect(self : PerspectiveCamera, aspect : Double) -> PerspectiveCamera

    PickHit

    pub(all) struct PickHit {
    node : NodeId
    primitive_index : Int
    distance : Double
    position : Vec3
    } derive(Eq, ToJson,
    Debug
    )

    PickHit::distance

    fn PickHit::distance(self : PickHit) -> Double

    PickHit::equal

    fn PickHit::equal(PickHit, PickHit) -> Bool

    PickHit::node

    fn PickHit::node(self : PickHit) -> NodeId

    PickHit::not_equal

    fn PickHit::not_equal(x : PickHit, y : PickHit) -> Bool

    PickHit::position

    fn PickHit::position(self : PickHit) -> Vec3

    PickHit::primitive_index

    fn PickHit::primitive_index(self : PickHit) -> Int

    PickHit::to_json

    fn PickHit::to_json(PickHit) -> Json

    PickHit::to_repr

    Primitive

    pub(all) struct Primitive {
    vertices : Array[Vertex]
    indices : Array[Int]
    material : MaterialId?
    bounds : Aabb
    morph_targets : Array[Array[VertexDelta]]
    } derive(
    Debug
    )

    Primitive::bounds

    fn Primitive::bounds(self : Primitive) -> Aabb

    Primitive::indices

    fn Primitive::indices(self : Primitive) -> Array[Int]

    Primitive::material

    fn Primitive::material(self : Primitive) -> MaterialId?

    Primitive::morph_targets

    fn Primitive::morph_targets(self : Primitive) -> Array[Array[VertexDelta]]

    Primitive::new

    fn Primitive::new(vertices~ : Array[Vertex], indices~ : Array[Int], material? : MaterialId?, morph_targets? : Array[Array[VertexDelta]]) -> Primitive

    Primitive::vertices

    fn Primitive::vertices(self : Primitive) -> Array[Vertex]

    Quat

    pub(all) struct Quat {
    x : Double
    y : Double
    z : Double
    w : Double
    } derive(Eq, ToJson,
    Debug
    )

    Quat::equal

    fn Quat::equal(Quat, Quat) -> Bool

    Quat::from_axis_angle

    fn Quat::from_axis_angle(axis~ : Vec3, angle~ : Double) -> Quat

    Quat::identity

    fn Quat::identity() -> Quat

    Quat::mul

    fn Quat::mul(self : Quat, other : Quat) -> Quat

    Quat::new

    fn Quat::new(x~ : Double, y~ : Double, z~ : Double, w~ : Double) -> Quat

    Quat::not_equal

    fn Quat::not_equal(x : Quat, y : Quat) -> Bool

    Quat::rotate

    fn Quat::rotate(self : Quat, vector : Vec3) -> Vec3

    Quat::to_json

    fn Quat::to_json(Quat) -> Json

    Quat::to_mat4

    fn Quat::to_mat4(self : Quat) -> Mat4

    Quat::to_repr

    Quat::w

    fn Quat::w(self : Quat) -> Double

    Quat::x

    fn Quat::x(self : Quat) -> Double

    Quat::y

    fn Quat::y(self : Quat) -> Double

    Quat::z

    fn Quat::z(self : Quat) -> Double

    Ray

    pub(all) struct Ray {
    origin : Vec3
    direction : Vec3
    } derive(Eq, ToJson,
    Debug
    )

    Ray::at

    fn Ray::at(self : Ray, distance : Double) -> Vec3

    Ray::direction

    fn Ray::direction(self : Ray) -> Vec3

    Ray::equal

    fn Ray::equal(Ray, Ray) -> Bool

    Ray::intersect_aabb

    fn Ray::intersect_aabb(self : Ray, bounds : Aabb) -> Bool

    Ray::intersect_triangle

    fn Ray::intersect_triangle(self : Ray, a : Vec3, b : Vec3, c : Vec3) -> Double?

    Moller-Trumbore ray/triangle intersection. Returns the positive distance.

    Ray::new

    fn Ray::new(origin~ : Vec3, direction~ : Vec3) -> Ray

    Ray::not_equal

    fn Ray::not_equal(x : Ray, y : Ray) -> Bool

    Ray::origin

    fn Ray::origin(self : Ray) -> Vec3

    Ray::to_json

    fn Ray::to_json(Ray) -> Json

    Ray::to_repr

    Sampler

    pub(all) struct Sampler {
    mag_filter : SamplerFilter
    min_filter : SamplerFilter
    wrap_s : SamplerWrap
    wrap_t : SamplerWrap
    } derive(Eq, ToJson,
    Debug
    )

    Sampler::equal

    fn Sampler::equal(Sampler, Sampler) -> Bool

    Sampler::mag_filter

    fn Sampler::mag_filter(self : Sampler) -> SamplerFilter

    Sampler::min_filter

    fn Sampler::min_filter(self : Sampler) -> SamplerFilter

    Sampler::new

    fn Sampler::new(mag_filter? : SamplerFilter, min_filter? : SamplerFilter, wrap_s? : SamplerWrap, wrap_t? : SamplerWrap) -> Sampler

    Sampler::not_equal

    fn Sampler::not_equal(x : Sampler, y : Sampler) -> Bool

    Sampler::to_json

    fn Sampler::to_json(Sampler) -> Json

    Sampler::to_repr

    Sampler::wrap_s

    fn Sampler::wrap_s(self : Sampler) -> SamplerWrap

    Sampler::wrap_t

    fn Sampler::wrap_t(self : Sampler) -> SamplerWrap

    SamplerFilter

    pub(all) enum SamplerFilter {
    Nearest
    Linear
    NearestMipmapNearest
    LinearMipmapNearest
    NearestMipmapLinear
    LinearMipmapLinear
    } derive(Eq, ToJson,
    Debug
    )

    SamplerFilter::equal

    SamplerFilter::not_equal

    fn SamplerFilter::not_equal(x : SamplerFilter, y : SamplerFilter) -> Bool

    SamplerFilter::to_json

    SamplerId

    pub(all) struct SamplerId {
    value : Int
    } derive(Eq, ToJson,
    Debug
    )

    SamplerId::equal

    fn SamplerId::equal(SamplerId, SamplerId) -> Bool

    SamplerId::new

    fn SamplerId::new(value : Int) -> SamplerId

    SamplerId::not_equal

    fn SamplerId::not_equal(x : SamplerId, y : SamplerId) -> Bool

    SamplerId::to_json

    fn SamplerId::to_json(SamplerId) -> Json

    SamplerId::value

    fn SamplerId::value(self : SamplerId) -> Int

    SamplerWrap

    pub(all) enum SamplerWrap {
    Repeat
    MirroredRepeat
    ClampToEdge
    } derive(Eq, ToJson,
    Debug
    )

    SamplerWrap::equal

    fn SamplerWrap::equal(SamplerWrap, SamplerWrap) -> Bool

    SamplerWrap::not_equal

    fn SamplerWrap::not_equal(x : SamplerWrap, y : SamplerWrap) -> Bool

    SamplerWrap::to_json

    fn SamplerWrap::to_json(SamplerWrap) -> Json

    Scene

    pub(all) struct Scene {
    meshes : Array[Mesh]
    materials : Array[Material]
    textures : Array[Texture]
    samplers : Array[Sampler]
    cameras : Array[Camera]
    definitions : Array[SceneDefinition]
    skins : Array[Skin]
    default_scene : Int?
    nodes : Array[Node]
    animations : Array[AnimationClip]
    } derive(
    Debug
    )

    Scene::add_animation

    fn Scene::add_animation(self : Scene, animation : AnimationClip) -> Int

    Scene::add_camera

    fn Scene::add_camera(self : Scene, camera : Camera) -> Int

    Scene::add_material

    fn Scene::add_material(self : Scene, material : Material) -> MaterialId

    Scene::add_mesh

    fn Scene::add_mesh(self : Scene, mesh : Mesh) -> MeshId

    Scene::add_node

    fn Scene::add_node(self : Scene, node : Node) -> NodeId

    Scene::add_sampler

    fn Scene::add_sampler(self : Scene, sampler : Sampler) -> SamplerId

    Scene::add_scene_definition

    fn Scene::add_scene_definition(self : Scene, definition : SceneDefinition) -> Int

    Scene::add_skin

    fn Scene::add_skin(self : Scene, skin : Skin) -> Int

    Scene::add_texture

    fn Scene::add_texture(self : Scene, texture : Texture) -> TextureId

    Scene::animations

    fn Scene::animations(self : Scene) -> Array[AnimationClip]

    Scene::apply_animation_samples

    fn Scene::apply_animation_samples(self : Scene, samples : Array[AnimationSample]) -> Scene

    Apply sampled animation channels to a copied scene. Unknown node ids and unsupported/empty samples are ignored so malformed optional channels do not invalidate an otherwise renderable scene.

    Scene::bounds

    fn Scene::bounds(self : Scene) -> Aabb

    Scene::cameras

    fn Scene::cameras(self : Scene) -> Array[Camera]

    Scene::copy

    fn Scene::copy(self : Scene) -> Scene

    Copy the scene containers before applying a transient animation pose. Mesh/material/animation values are immutable, while nodes are replaced in the returned scene and never mutated in the authored scene.

    Scene::default_scene

    fn Scene::default_scene(self : Scene) -> Int?

    Scene::empty

    fn Scene::empty() -> Scene

    Scene::materials

    fn Scene::materials(self : Scene) -> Array[Material]

    Scene::mesh

    fn Scene::mesh(self : Scene, id : MeshId) -> Mesh?

    Scene::meshes

    fn Scene::meshes(self : Scene) -> Array[Mesh]

    Scene::node

    fn Scene::node(self : Scene, id : NodeId) -> Node?

    Scene::nodes

    fn Scene::nodes(self : Scene) -> Array[Node]

    Scene::pick

    fn Scene::pick(self : Scene, ray : Ray) -> PickHit?

    Scene::samplers

    fn Scene::samplers(self : Scene) -> Array[Sampler]

    Scene::scene_definitions

    fn Scene::scene_definitions(self : Scene) -> Array[SceneDefinition]

    Scene::set_default_scene

    fn Scene::set_default_scene(self : Scene, index : Int?) -> Unit

    Scene::skins

    fn Scene::skins(self : Scene) -> Array[Skin]

    Scene::textures

    fn Scene::textures(self : Scene) -> Array[Texture]

    Scene::to_repr

    Scene::world_transform

    fn Scene::world_transform(self : Scene, id : NodeId) -> Mat4

    SceneDefinition

    pub(all) struct SceneDefinition {
    name : String
    roots : Array[NodeId]
    } derive(Eq, ToJson,
    Debug
    )

    SceneDefinition::equal

    SceneDefinition::name

    fn SceneDefinition::name(self : SceneDefinition) -> String

    SceneDefinition::new

    fn SceneDefinition::new(name? : String, roots~ : Array[NodeId]) -> SceneDefinition

    SceneDefinition::not_equal

    fn SceneDefinition::not_equal(x : SceneDefinition, y : SceneDefinition) -> Bool

    SceneDefinition::roots

    SceneDefinition::to_json

    Skin

    pub(all) struct Skin {
    name : String
    joints : Array[NodeId]
    inverse_bind_matrices : Array[Mat4]
    skeleton : NodeId?
    } derive(
    Debug
    )

    Skin::inverse_bind_matrices

    fn Skin::inverse_bind_matrices(self : Skin) -> Array[Mat4]

    Skin::joints

    fn Skin::joints(self : Skin) -> Array[NodeId]

    Skin::name

    fn Skin::name(self : Skin) -> String

    Skin::new

    fn Skin::new(name? : String, joints~ : Array[NodeId], inverse_bind_matrices? : Array[Mat4], skeleton? : NodeId?) -> Skin

    Skin::skeleton

    fn Skin::skeleton(self : Skin) -> NodeId?

    Skin::to_repr

    Texture

    pub(all) struct Texture {
    source : TextureSource
    mime_type : String?
    sampler : SamplerId?
    } derive(
    Debug
    )

    Texture::embedded

    fn Texture::embedded(bytes : Bytes, mime_type? : String?, sampler? : SamplerId?) -> Texture

    Texture::mime_type

    fn Texture::mime_type(self : Texture) -> String?

    Texture::sampler

    fn Texture::sampler(self : Texture) -> SamplerId?

    Texture::source

    fn Texture::source(self : Texture) -> TextureSource

    Texture::to_repr

    Texture::uri

    fn Texture::uri(uri : String, mime_type? : String?, sampler? : SamplerId?) -> Texture

    TextureId

    pub(all) struct TextureId {
    value : Int
    } derive(Eq, ToJson,
    Debug
    )

    TextureId::equal

    fn TextureId::equal(TextureId, TextureId) -> Bool

    TextureId::new

    fn TextureId::new(value : Int) -> TextureId

    TextureId::not_equal

    fn TextureId::not_equal(x : TextureId, y : TextureId) -> Bool

    TextureId::to_json

    fn TextureId::to_json(TextureId) -> Json

    TextureId::value

    fn TextureId::value(self : TextureId) -> Int

    TextureSource

    pub(all) enum TextureSource {
    Uri(String)
    Embedded(Bytes)
    } derive(
    Debug
    )

    ThreeDViewportBinding

    pub struct ThreeDViewportBinding {
    latest :
    Ref
    [ViewportSnapshot?]
    status :
    Ref
    [ViewportStatus]
    }

    Latest-wins CPU bridge between a MoUI view and an external 3D surface. Renderer residency and GPU cache state never cross this boundary.

    ThreeDViewportBinding::new

    ThreeDViewportBinding::publish

    fn ThreeDViewportBinding::publish(self : ThreeDViewportBinding, snapshot : ViewportSnapshot) -> Bool

    ThreeDViewportBinding::set_status

    fn ThreeDViewportBinding::set_status(self : ThreeDViewportBinding, status : ViewportStatus) -> Unit

    ThreeDViewportBinding::snapshot

    ThreeDViewportBinding::status

    ThreeDViewportHost

    pub struct ThreeDViewportHost {
    binding : ThreeDViewportBinding
    surface_handler :
    Ref
    [(UInt64, Int, Int, Double) -> Unit]
    frame_handler :
    Ref
    [(ViewportSnapshot, Int, Int, Double) -> Unit]
    dispose_handler :
    Ref
    [(UInt64) -> Unit]
    invalidate_handler :
    Ref
    [() -> Unit]
    }

    Addon-owned bridge between a platform-view plugin and a concrete 3D renderer. The bridge carries only CPU snapshots and surface geometry; renderer resources never cross into the MoUI frame contract.

    ThreeDViewportHost::binding

    ThreeDViewportHost::dispose_platform_views

    fn ThreeDViewportHost::dispose_platform_views(self : ThreeDViewportHost, window_handle : UInt64) -> Unit

    ThreeDViewportHost::invalidate

    fn ThreeDViewportHost::invalidate(self : ThreeDViewportHost) -> Unit

    ThreeDViewportHost::new

    ThreeDViewportHost::set_dispose_handler

    fn ThreeDViewportHost::set_dispose_handler(self : ThreeDViewportHost, handler : (UInt64) -> Unit) -> Unit

    ThreeDViewportHost::set_frame_handler

    fn ThreeDViewportHost::set_frame_handler(self : ThreeDViewportHost, handler : (ViewportSnapshot, Int, Int, Double) -> Unit) -> Unit

    ThreeDViewportHost::set_invalidate_handler

    fn ThreeDViewportHost::set_invalidate_handler(self : ThreeDViewportHost, handler : () -> Unit) -> Unit

    Install the platform redraw hook used when renderer availability changes outside the ordinary MoUI model update path.

    ThreeDViewportHost::set_surface_handler

    fn ThreeDViewportHost::set_surface_handler(self : ThreeDViewportHost, handler : (UInt64, Int, Int, Double) -> Unit) -> Unit

    Called by a concrete renderer composition root once it is ready to interpret the platform surface handle.

    ThreeDViewportHost::sync_platform_view

    fn ThreeDViewportHost::sync_platform_view(self : ThreeDViewportHost, window_handle : UInt64, placement :
    PlatformViewPlacement
    , surface_handle : UInt64, frame :
    DrawFrame
    , content_offset_y : Double, scale_factor? : Double) -> Unit

    Sync one placement after a platform plugin has created or resolved its concrete child surface handle.

    ThreeDViewportHost::sync_platform_views

    fn ThreeDViewportHost::sync_platform_views(self : ThreeDViewportHost, window_handle : UInt64, frame :
    DrawFrame
    , content_offset_y : Double) -> Unit

    Synchronize all placements owned by the 3D addon. The plugin passes the host window handle; a native backend may replace it with a child surface handle before invoking the frame handler.

    Vec2

    pub(all) struct Vec2 {
    x : Double
    y : Double
    } derive(Eq, ToJson,
    Debug
    )

    A two-dimensional vector used by the 3D addon for texture coordinates and screen-space input.

    Vec2::equal

    fn Vec2::equal(Vec2, Vec2) -> Bool

    Vec2::new

    fn Vec2::new(x~ : Double, y~ : Double) -> Vec2

    Vec2::not_equal

    fn Vec2::not_equal(x : Vec2, y : Vec2) -> Bool

    Vec2::to_json

    fn Vec2::to_json(Vec2) -> Json

    Vec2::to_repr

    Vec2::x

    fn Vec2::x(self : Vec2) -> Double

    Vec2::y

    fn Vec2::y(self : Vec2) -> Double

    Vec2::zero

    fn Vec2::zero() -> Vec2

    Vec3

    pub(all) struct Vec3 {
    x : Double
    y : Double
    z : Double
    } derive(Eq, ToJson,
    Debug
    )

    A three-dimensional vector. Public scene coordinates use Double so camera and picking calculations stay deterministic before GPU packing.

    Vec3::add

    fn Vec3::add(self : Vec3, other : Vec3) -> Vec3

    Vec3::cross

    fn Vec3::cross(self : Vec3, other : Vec3) -> Vec3

    Vec3::dot

    fn Vec3::dot(self : Vec3, other : Vec3) -> Double

    Vec3::equal

    fn Vec3::equal(Vec3, Vec3) -> Bool

    Vec3::length

    fn Vec3::length(self : Vec3) -> Double

    Vec3::length_squared

    fn Vec3::length_squared(self : Vec3) -> Double

    Vec3::lerp

    fn Vec3::lerp(self : Vec3, other : Vec3, progress : Double) -> Vec3

    Vec3::new

    fn Vec3::new(x~ : Double, y~ : Double, z~ : Double) -> Vec3

    Vec3::normalized

    fn Vec3::normalized(self : Vec3) -> Vec3

    Vec3::not_equal

    fn Vec3::not_equal(x : Vec3, y : Vec3) -> Bool

    Vec3::scale

    fn Vec3::scale(self : Vec3, amount : Double) -> Vec3

    Vec3::sub

    fn Vec3::sub(self : Vec3, other : Vec3) -> Vec3

    Vec3::to_json

    fn Vec3::to_json(Vec3) -> Json

    Vec3::to_repr

    Vec3::x

    fn Vec3::x(self : Vec3) -> Double

    Vec3::y

    fn Vec3::y(self : Vec3) -> Double

    Vec3::z

    fn Vec3::z(self : Vec3) -> Double

    Vec3::zero

    fn Vec3::zero() -> Vec3

    Vec4

    pub(all) struct Vec4 {
    x : Double
    y : Double
    z : Double
    w : Double
    } derive(Eq, ToJson,
    Debug
    )

    A four-dimensional vector used for colors and homogeneous coordinates.

    Vec4::equal

    fn Vec4::equal(Vec4, Vec4) -> Bool

    Vec4::new

    fn Vec4::new(x~ : Double, y~ : Double, z~ : Double, w~ : Double) -> Vec4

    Vec4::not_equal

    fn Vec4::not_equal(x : Vec4, y : Vec4) -> Bool

    Vec4::scale

    fn Vec4::scale(self : Vec4, amount : Double) -> Vec4

    Vec4::to_json

    fn Vec4::to_json(Vec4) -> Json

    Vec4::to_repr

    Vec4::w

    fn Vec4::w(self : Vec4) -> Double

    Vec4::x

    fn Vec4::x(self : Vec4) -> Double

    Vec4::y

    fn Vec4::y(self : Vec4) -> Double

    Vec4::z

    fn Vec4::z(self : Vec4) -> Double

    Vec4::zero

    fn Vec4::zero() -> Vec4

    Vertex

    pub(all) struct Vertex {
    position : Vec3
    normal : Vec3
    texcoord : Vec2
    joints : (Int, Int, Int, Int)
    weights : Vec4
    } derive(Eq, ToJson,
    Debug
    )

    Vertex::equal

    fn Vertex::equal(Vertex, Vertex) -> Bool

    Vertex::joints

    fn Vertex::joints(self : Vertex) -> (Int, Int, Int, Int)

    Vertex::new

    fn Vertex::new(position~ : Vec3, normal? : Vec3, texcoord? : Vec2, joints? : (Int, Int, Int, Int), weights? : Vec4) -> Vertex

    Vertex::normal

    fn Vertex::normal(self : Vertex) -> Vec3

    Vertex::not_equal

    fn Vertex::not_equal(x : Vertex, y : Vertex) -> Bool

    Vertex::position

    fn Vertex::position(self : Vertex) -> Vec3

    Vertex::texcoord

    fn Vertex::texcoord(self : Vertex) -> Vec2

    Vertex::to_json

    fn Vertex::to_json(Vertex) -> Json

    Vertex::to_repr

    Vertex::weights

    fn Vertex::weights(self : Vertex) -> Vec4

    VertexDelta

    pub(all) struct VertexDelta {
    position : Vec3
    normal : Vec3
    tangent : Vec3
    } derive(Eq, ToJson,
    Debug
    )

    VertexDelta::equal

    fn VertexDelta::equal(VertexDelta, VertexDelta) -> Bool

    VertexDelta::new

    fn VertexDelta::new(position? : Vec3, normal? : Vec3, tangent? : Vec3) -> VertexDelta

    VertexDelta::normal

    fn VertexDelta::normal(self : VertexDelta) -> Vec3

    VertexDelta::not_equal

    fn VertexDelta::not_equal(x : VertexDelta, y : VertexDelta) -> Bool

    VertexDelta::position

    fn VertexDelta::position(self : VertexDelta) -> Vec3

    VertexDelta::tangent

    fn VertexDelta::tangent(self : VertexDelta) -> Vec3

    VertexDelta::to_json

    fn VertexDelta::to_json(VertexDelta) -> Json

    ViewportEvent

    pub(all) enum ViewportEvent {
    PointerDown(
    Point
    )
    PointerMove(
    Point
    )
    PointerUp(
    Point
    )
    Wheel(Double)
    Resize(
    Size
    )
    Focus(Bool)
    Pick(NodeId)
    RendererStatus
    } derive(Eq,
    Debug
    )

    ViewportEvent::equal

    ViewportEvent::not_equal

    fn ViewportEvent::not_equal(x : ViewportEvent, y : ViewportEvent) -> Bool

    ViewportSnapshot

    pub(all) struct ViewportSnapshot {
    scene_revision : Int64
    scene : Scene
    camera : OrbitCamera
    bounds : Aabb
    } derive(
    Debug
    )

    ViewportSnapshot::bounds

    fn ViewportSnapshot::bounds(self : ViewportSnapshot) -> Aabb

    ViewportSnapshot::camera

    ViewportSnapshot::new

    fn ViewportSnapshot::new(scene_revision~ : Int64, scene~ : Scene, camera~ : OrbitCamera) -> ViewportSnapshot

    ViewportSnapshot::scene

    ViewportSnapshot::scene_revision

    fn ViewportSnapshot::scene_revision(self : ViewportSnapshot) -> Int64

    ViewportStatus

    pub(all) enum ViewportStatus {
    Loading
    Ready
    Unavailable(String)
    Failed(String)
    } derive(Eq, ToJson,
    Debug
    )

    ViewportStatus::equal

    ViewportStatus::not_equal

    fn ViewportStatus::not_equal(x : ViewportStatus, y : ViewportStatus) -> Bool

    ViewportStatus::to_json

    decode_viewport_event

    Decode the stable, human-readable platform event names used by the addon plugin. Pointer payloads are x,y; wheel payload is a signed scalar.

    load_asset

    fn load_asset(source : AssetByteSource, asset : TextureSource) -> AssetLoadResult

    Resolve an embedded asset directly or delegate URI lookup to the injected source. This small helper is deterministic and easy to test.

    load_gltf_scene

    fn load_gltf_scene(json : String, binary? : Bytes?, resolve? : (String) -> Bytes??) -> Scene raise GltfError

    Decode the supported glTF subset into the addon scene model.

    This function accepts already-loaded bytes only. binary is the GLB BIN chunk (or the single buffer supplied by an app); external JSON resources are obtained through resolve.

    parse_glb

    fn parse_glb(bytes : Bytes) -> GltfDocument raise GltfError

    parse_gltf_json

    fn parse_gltf_json(json : String, binary? : Bytes?) -> GltfDocument raise GltfError

    sample_animation_channel

    fn sample_animation_channel(channel : AnimationChannel, time : Double) -> Array[Double]

    three_d_viewport

    fn[Msg] three_d_viewport(binding~ : ThreeDViewportBinding, snapshot~ : ViewportSnapshot, semantics_label? : String, on_event? : (ViewportEvent) -> Msg?) ->
    View
    [Msg]