Experimental 3D scene and glTF viewer addon for MoUI
Dependencies
type GltfResourceResolver = (String) -> Bytes?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)pub(all) struct AnimationChannel {
node : NodeId
path : AnimationPath
interpolation : AnimationInterpolation
keyframes : Array[AnimationKeyframe]
} derive(Debug)fn AnimationChannel::new(node~ : NodeId, path~ : AnimationPath, interpolation~ : AnimationInterpolation, keyframes~ : Array[AnimationKeyframe]) -> AnimationChannelpub(all) struct AnimationClip {
name : String
channels : Array[AnimationChannel]
duration : Double
} derive(Debug)fn AnimationInterpolation::not_equal(x : AnimationInterpolation, y : AnimationInterpolation) -> Boolfn AnimationKeyframe::new(time~ : Double, value~ : Array[Double], in_tangent? : Array[Double], out_tangent? : Array[Double]) -> AnimationKeyframepub(all) struct AnimationSample {
node : NodeId
path : AnimationPath
value : Array[Double]
} derive(Debug)fn AnimationSample::new(node~ : NodeId, path~ : AnimationPath, value~ : Array[Double]) -> AnimationSamplepub(all) struct AssetByteSource {
read_fn : (String) -> Bytes?
}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)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)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) -> Materialpub(all) struct OrbitCamera {
target : Vec3
radius : Double
azimuth : Double
polar : Double
perspective : PerspectiveCamera
} derive(Eq, ToJson, Debug)fn OrbitCamera::new(target? : Vec3, radius? : Double, azimuth? : Double, polar? : Double, perspective? : PerspectiveCamera) -> OrbitCamerafn OrbitCamera::orbit(self : OrbitCamera, delta_azimuth : Double, delta_polar : Double) -> OrbitCamerafn PerspectiveCamera::new(fov_y_radians? : Double, aspect? : Double, near? : Double, far? : Double) -> PerspectiveCamerapub(all) struct Primitive {
vertices : Array[Vertex]
indices : Array[Int]
material : MaterialId?
bounds : Aabb
morph_targets : Array[Array[VertexDelta]]
} derive(Debug)fn Primitive::new(vertices~ : Array[Vertex], indices~ : Array[Int], material? : MaterialId?, morph_targets? : Array[Array[VertexDelta]]) -> Primitivepub(all) struct Sampler {
mag_filter : SamplerFilter
min_filter : SamplerFilter
wrap_s : SamplerWrap
wrap_t : SamplerWrap
} derive(Eq, ToJson, Debug)fn Sampler::new(mag_filter? : SamplerFilter, min_filter? : SamplerFilter, wrap_s? : SamplerWrap, wrap_t? : SamplerWrap) -> Samplerpub(all) struct Texture {
source : TextureSource
mime_type : String?
sampler : SamplerId?
} derive(Debug)fn ThreeDViewportBinding::publish(self : ThreeDViewportBinding, snapshot : ViewportSnapshot) -> Boolpub 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]
}fn ThreeDViewportHost::dispose_platform_views(self : ThreeDViewportHost, window_handle : UInt64) -> Unitfn ThreeDViewportHost::set_dispose_handler(self : ThreeDViewportHost, handler : (UInt64) -> Unit) -> Unitfn ThreeDViewportHost::set_frame_handler(self : ThreeDViewportHost, handler : (ViewportSnapshot, Int, Int, Double) -> Unit) -> Unitfn ThreeDViewportHost::set_invalidate_handler(self : ThreeDViewportHost, handler : () -> Unit) -> Unitfn ThreeDViewportHost::set_surface_handler(self : ThreeDViewportHost, handler : (UInt64, Int, Int, Double) -> Unit) -> Unitfn ThreeDViewportHost::sync_platform_view(self : ThreeDViewportHost, window_handle : UInt64, placement : PlatformViewPlacement, surface_handle : UInt64, frame : DrawFrame, content_offset_y : Double, scale_factor? : Double) -> Unitfn ThreeDViewportHost::sync_platform_views(self : ThreeDViewportHost, window_handle : UInt64, frame : DrawFrame, content_offset_y : Double) -> Unitpub(all) struct ViewportSnapshot {
scene_revision : Int64
scene : Scene
camera : OrbitCamera
bounds : Aabb
} derive(Debug)fn ViewportSnapshot::new(scene_revision~ : Int64, scene~ : Scene, camera~ : OrbitCamera) -> ViewportSnapshotfn[Msg] three_d_viewport(binding~ : ThreeDViewportBinding, snapshot~ : ViewportSnapshot, semantics_label? : String, on_event? : (ViewportEvent) -> Msg?) -> View[Msg]Install
Download zipExperimental 3D scene and glTF viewer addon for MoUI
Dependencies