meshopt_mbt

    MoonBit bindings for meshoptimizer

    mesh
    meshoptimizer
    graphics
    ffi
    Download zip
    Author
    Version
    0.1.2
    License
    Apache-2.0
    Last updated
    14 days ago
    Downloads
    148

    #Milky2018/meshopt_mbt

    MoonBit native bindings for meshoptimizer.

    This package vendors meshoptimizer's core library sources and exposes safe MoonBit wrappers over the native C ABI. The bindings cover meshoptimizer's public C API groups:

    • quantization helpers
    • vertex remap, multi-stream remap, shadow remap, and remap application
    • custom vertex remap callbacks through a MoonBit closure trampoline
    • vertex cache, overdraw, and vertex fetch optimization
    • index, index sequence, vertex, filter, and meshlet codecs
    • stripification and unstripification
    • vertex cache, fetch, overdraw, and coverage analysis
    • simplification, including attributes, locks, point simplification, and update-in-place simplification
    • meshlet building, meshlet bounds, cluster bounds, sphere bounds, extraction, and clustering
    • spatial sort, tangent generation, position exponent, and opacity map helpers

    The package targets MoonBit's native backend.

    #Examples

    #Index Codec

    ///|
    test {
    let indices : FixedArray[UInt] = [0U, 1U, 2U, 2U, 1U, 3U]
    let encoded = try! @meshopt_mbt.encode_index_buffer(indices, 4)
    let decoded = try! @meshopt_mbt.decode_index_buffer(
    encoded.data,
    indices.length(),
    )
    assert_true(decoded == indices)
    }

    #Vertex Remap

    ///|
    test {
    let vertices = Bytes::makei(4, i => {
    match i {
    0 => b'\x01'
    1 => b'\x02'
    2 => b'\x01'
    _ => b'\x03'
    }
    })
    let (remap, unique_count) = try! @meshopt_mbt.generate_vertex_remap_unindexed(
    vertices, 4, 1,
    )
    assert_eq(unique_count, 3)
    assert_true(remap == [0U, 1U, 0U, 2U])
    let compacted = try! @meshopt_mbt.remap_vertex_buffer(
    vertices, 4, 1, unique_count, remap,
    )
    assert_eq(compacted.length(), 3)
    }

    #Optimization And Analysis

    ///|
    test {
    let indices : FixedArray[UInt] = [0U, 1U, 2U, 2U, 1U, 3U]
    let optimized = try! @meshopt_mbt.optimize_vertex_cache(indices, 4)
    assert_eq(optimized.length(), indices.length())

    let stats = try! @meshopt_mbt.analyze_vertex_cache(optimized, 4)
    assert_true(stats.vertices_transformed >= 4U)
    assert_true(stats.acmr > 0.0F)
    }

    #Meshlets And Bounds

    ///|
    test {
    let indices : FixedArray[UInt] = [0U, 1U, 2U, 2U, 1U, 3U]
    let positions : FixedArray[Float] = [
    0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 1.0F, 1.0F, 0.0F,
    ]

    let meshlets = try! @meshopt_mbt.build_meshlets(
    indices, positions, 4, 12, 64, 64,
    )
    assert_true(meshlets.meshlet_count > 0)

    let bounds = try! @meshopt_mbt.compute_cluster_bounds(
    indices, positions, 4, 12,
    )
    assert_true(bounds.radius >= 0.0F)
    }

    #Vendored Source

    The vendored meshoptimizer source is from upstream commit 75b96fed4e8b914fbfb5ce83f0a31266d1dd836c dated 2026-05-13.

    Only the core src library and upstream license are vendored. gltfpack, demos, JavaScript bindings, and sample assets are intentionally excluded.

    The native build uses MESHOPTIMIZER_ALLOC_EXPORT with a C allocator shim in the vendored allocator source. This keeps the package buildable through MoonBit native stubs without requiring downstream users to add C++ runtime linker flags.

    One upstream escape hatch is intentionally not exposed as an ordinary safe MoonBit API:

    • meshopt_setAllocator: allocation is fixed to the package's native stub allocator so consumers do not need to manage a process-wide C++ allocator callback.

    #Development

    Run:

    moon fmt --check moon check --target native --warn-list +73 moon test --target native moon info moon fmt

    The test suite includes README doctests, API smoke tests, and a cube mesh fixture that exercises codecs, optimization, simplification, meshlets, bounds, and stripification on a realistic indexed mesh. It also includes extracted geometry from the Khronos glTF Sample Assets BoxTextured model to exercise asset-style UV attributes, tangent generation, opacity map measurement, and spatial sorting.

    For native memory-safety smoke testing, run:

    scripts/asan-smoke.sh

    This compiles the native wrapper and vendored meshoptimizer sources with AddressSanitizer and UndefinedBehaviorSanitizer, then executes representative wrapper calls. CI runs native MoonBit tests on Linux and macOS, plus the sanitizer smoke test on Linux.

    Further binding work should follow the same pattern: keep raw FFI declarations private, mediate ABI details in the native wrapper when needed, and expose validated MoonBit APIs that test external behavior rather than implementation details.

    MeshoptError

    pub suberror MeshoptError {
    MeshoptError(String)
    } derive(Eq,
    Debug
    )

    MeshoptError::equal

    MeshoptError::not_equal

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

    Bounds

    pub struct Bounds {
    center_x : Float
    center_y : Float
    center_z : Float
    radius : Float
    cone_apex_x : Float
    cone_apex_y : Float
    cone_apex_z : Float
    cone_axis_x : Float
    cone_axis_y : Float
    cone_axis_z : Float
    cone_cutoff : Float
    cone_axis_s8_x : Int
    cone_axis_s8_y : Int
    cone_axis_s8_z : Int
    cone_cutoff_s8 : Int
    } derive(Eq,
    Debug
    )

    Bounds::equal

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

    Bounds::not_equal

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

    Bounds::to_repr

    CoverageStatistics

    pub struct CoverageStatistics {
    coverage_x : Float
    coverage_y : Float
    coverage_z : Float
    extent : Float
    } derive(Eq,
    Debug
    )

    CoverageStatistics::equal

    CoverageStatistics::not_equal

    EncodeExpMode

    pub enum EncodeExpMode {
    Separate
    SharedVector
    SharedComponent
    Clamped
    } derive(Eq,
    Debug
    )

    EncodeExpMode::equal

    EncodeExpMode::not_equal

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

    MeshletBuild

    pub struct MeshletBuild {
    meshlets : FixedArray[UInt]
    vertices : FixedArray[UInt]
    triangles : Bytes
    meshlet_count : Int
    } derive(Eq,
    Debug
    )

    MeshletBuild::equal

    MeshletBuild::not_equal

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

    MeshletDecode

    pub struct MeshletDecode {
    vertices : Bytes
    triangles : Bytes
    } derive(Eq,
    Debug
    )

    MeshletDecode::equal

    MeshletDecode::not_equal

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

    MeshletDecodeRaw

    pub struct MeshletDecodeRaw {
    vertices : FixedArray[UInt]
    triangles : FixedArray[UInt]
    } derive(Eq,
    Debug
    )

    MeshletDecodeRaw::equal

    MeshletDecodeRaw::not_equal

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

    MeshoptData

    pub struct MeshoptData {
    data : Bytes
    length : Int
    } derive(Eq,
    Debug
    )

    MeshoptData::equal

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

    MeshoptData::not_equal

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

    OpacityMapMeasure

    pub struct OpacityMapMeasure {
    levels : Bytes
    sources : FixedArray[UInt]
    omm_indices : FixedArray[Int]
    count : Int
    } derive(Eq,
    Debug
    )

    OpacityMapMeasure::equal

    OpacityMapMeasure::not_equal

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

    OverdrawStatistics

    pub struct OverdrawStatistics {
    pixels_covered : UInt
    pixels_shaded : UInt
    overdraw : Float
    } derive(Eq,
    Debug
    )

    OverdrawStatistics::equal

    OverdrawStatistics::not_equal

    PackedStreams

    pub struct PackedStreams {
    source : Bytes
    offsets : FixedArray[Int]
    sizes : FixedArray[Int]
    strides : FixedArray[Int]
    stream_count : Int
    } derive(Eq,
    Debug
    )

    PackedStreams::equal

    PackedStreams::new

    fn PackedStreams::new(source : Bytes, offsets : FixedArray[Int], sizes : FixedArray[Int], strides : FixedArray[Int], stream_count : Int) -> PackedStreams

    PackedStreams::not_equal

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

    ProvokingIndexBuffer

    pub struct ProvokingIndexBuffer {
    indices : FixedArray[UInt]
    reorder : FixedArray[UInt]
    reorder_count : Int
    } derive(Eq,
    Debug
    )

    ProvokingIndexBuffer::equal

    ProvokingIndexBuffer::not_equal

    SimplifyOptions

    pub struct SimplifyOptions(UInt) derive(Eq,
    Debug
    )

    SimplifyOptions::bits

    fn SimplifyOptions::bits(self : SimplifyOptions) -> UInt

    SimplifyOptions::equal

    SimplifyOptions::new

    fn SimplifyOptions::new(lock_border? : Bool, sparse? : Bool, error_absolute? : Bool, prune? : Bool, regularize? : Bool, permissive? : Bool, regularize_light? : Bool) -> SimplifyOptions

    SimplifyOptions::not_equal

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

    SimplifyResult

    pub struct SimplifyResult {
    indices : FixedArray[UInt]
    index_count : Int
    error : Float
    } derive(Eq,
    Debug
    )

    SimplifyResult::equal

    SimplifyResult::not_equal

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

    TangentOptions

    pub struct TangentOptions(UInt) derive(Eq,
    Debug
    )

    TangentOptions::bits

    fn TangentOptions::bits(self : TangentOptions) -> UInt

    TangentOptions::equal

    TangentOptions::new

    fn TangentOptions::new(compatible? : Bool, zero_fallback? : Bool) -> TangentOptions

    TangentOptions::not_equal

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

    VertexCacheStatistics

    pub struct VertexCacheStatistics {
    vertices_transformed : UInt
    warps_executed : UInt
    acmr : Float
    atvr : Float
    } derive(Eq,
    Debug
    )

    VertexCacheStatistics::equal

    VertexCacheStatistics::not_equal

    VertexFetchOptimization

    pub struct VertexFetchOptimization {
    vertices : Bytes
    indices : FixedArray[UInt]
    unique_vertex_count : Int
    } derive(Eq,
    Debug
    )

    VertexFetchOptimization::equal

    VertexFetchOptimization::not_equal

    VertexFetchStatistics

    pub struct VertexFetchStatistics {
    bytes_fetched : UInt
    overfetch : Float
    } derive(Eq,
    Debug
    )

    VertexFetchStatistics::equal

    VertexFetchStatistics::not_equal

    VertexLockFlags

    pub struct VertexLockFlags(Byte) derive(Eq,
    Debug
    )

    VertexLockFlags::byte

    fn VertexLockFlags::byte(self : VertexLockFlags) -> Byte

    VertexLockFlags::equal

    VertexLockFlags::new

    fn VertexLockFlags::new(lock? : Bool, protect? : Bool, priority? : Bool) -> VertexLockFlags

    VertexLockFlags::not_equal

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

    analyze_coverage

    fn analyze_coverage(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int) -> CoverageStatistics raise MeshoptError

    analyze_overdraw

    fn analyze_overdraw(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int) -> OverdrawStatistics raise MeshoptError

    analyze_vertex_cache

    fn analyze_vertex_cache(indices : FixedArray[UInt], vertex_count : Int, cache_size? : UInt, warp_size? : UInt, primgroup_size? : UInt) -> VertexCacheStatistics raise MeshoptError

    analyze_vertex_fetch

    fn analyze_vertex_fetch(indices : FixedArray[UInt], vertex_count : Int, vertex_size : Int) -> VertexFetchStatistics raise MeshoptError

    build_meshlets

    fn build_meshlets(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, max_vertices : Int, max_triangles : Int, cone_weight? : Float) -> MeshletBuild raise MeshoptError

    build_meshlets_bound

    fn build_meshlets_bound(index_count : Int, max_vertices : Int, max_triangles : Int) -> Int raise MeshoptError

    build_meshlets_flex

    fn build_meshlets_flex(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, max_vertices : Int, min_triangles : Int, max_triangles : Int, cone_weight? : Float, split_factor? : Float) -> MeshletBuild raise MeshoptError

    build_meshlets_scan

    fn build_meshlets_scan(indices : FixedArray[UInt], vertex_count : Int, max_vertices : Int, max_triangles : Int) -> MeshletBuild raise MeshoptError

    build_meshlets_spatial

    fn build_meshlets_spatial(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, max_vertices : Int, min_triangles : Int, max_triangles : Int, fill_weight? : Float) -> MeshletBuild raise MeshoptError

    compute_cluster_bounds

    fn compute_cluster_bounds(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int) -> Bounds raise MeshoptError

    compute_meshlet_bounds

    fn compute_meshlet_bounds(meshlet_vertices : FixedArray[UInt], meshlet_triangles : Bytes, triangle_count : Int, positions : FixedArray[Float], vertex_count : Int, positions_stride : Int) -> Bounds raise MeshoptError

    compute_position_exponent

    fn compute_position_exponent(minv : FixedArray[Float], maxv : FixedArray[Float], min_exp : Int, max_bits : Int) -> Int raise MeshoptError

    compute_sphere_bounds

    fn compute_sphere_bounds(positions : FixedArray[Float], count : Int, positions_stride : Int, radii? : FixedArray[Float], radii_stride? : Int) -> Bounds raise MeshoptError

    decode_filter_color

    fn decode_filter_color(buffer : Bytes, count : Int, stride : Int) -> Bytes raise MeshoptError

    decode_filter_exp

    fn decode_filter_exp(buffer : Bytes, count : Int, stride : Int) -> Bytes raise MeshoptError

    decode_filter_oct

    fn decode_filter_oct(buffer : Bytes, count : Int, stride : Int) -> Bytes raise MeshoptError

    decode_filter_quat

    fn decode_filter_quat(buffer : Bytes, count : Int, stride : Int) -> Bytes raise MeshoptError

    decode_index_buffer

    fn decode_index_buffer(encoded : Bytes, index_count : Int) -> FixedArray[UInt] raise MeshoptError

    decode_index_buffer_bytes

    fn decode_index_buffer_bytes(encoded : Bytes, index_count : Int, index_size : Int) -> Bytes raise MeshoptError

    decode_index_sequence

    fn decode_index_sequence(encoded : Bytes, index_count : Int) -> FixedArray[UInt] raise MeshoptError

    decode_index_sequence_bytes

    fn decode_index_sequence_bytes(encoded : Bytes, index_count : Int, index_size : Int) -> Bytes raise MeshoptError

    decode_index_version

    fn decode_index_version(encoded : Bytes) -> Int

    decode_meshlet

    fn decode_meshlet(encoded : Bytes, vertex_count : Int, vertex_size : Int, triangle_count : Int, triangle_size : Int) -> MeshletDecode raise MeshoptError

    decode_meshlet_raw

    fn decode_meshlet_raw(encoded : Bytes, vertex_count : Int, triangle_count : Int) -> MeshletDecodeRaw raise MeshoptError

    decode_vertex_buffer

    fn decode_vertex_buffer(encoded : Bytes, vertex_count : Int, vertex_size : Int) -> Bytes raise MeshoptError

    decode_vertex_version

    fn decode_vertex_version(encoded : Bytes) -> Int

    dequantize_half

    fn dequantize_half(value : UInt) -> Float

    encode_filter_color

    fn encode_filter_color(data : FixedArray[Float], count : Int, stride : Int, bits : Int) -> Bytes raise MeshoptError

    encode_filter_exp

    fn encode_filter_exp(data : FixedArray[Float], count : Int, stride : Int, bits : Int, mode? : EncodeExpMode) -> Bytes raise MeshoptError

    encode_filter_oct

    fn encode_filter_oct(data : FixedArray[Float], count : Int, stride : Int, bits : Int) -> Bytes raise MeshoptError

    encode_filter_quat

    fn encode_filter_quat(data : FixedArray[Float], count : Int, stride : Int, bits : Int) -> Bytes raise MeshoptError

    encode_index_buffer

    fn encode_index_buffer(indices : FixedArray[UInt], vertex_count : Int) -> MeshoptData raise MeshoptError

    encode_index_buffer_bound

    fn encode_index_buffer_bound(index_count : Int, vertex_count : Int) -> Int raise MeshoptError

    encode_index_sequence

    fn encode_index_sequence(indices : FixedArray[UInt], vertex_count : Int) -> MeshoptData raise MeshoptError

    encode_index_sequence_bound

    fn encode_index_sequence_bound(index_count : Int, vertex_count : Int) -> Int raise MeshoptError

    encode_index_version

    fn encode_index_version(version : Int) -> Unit raise MeshoptError

    encode_meshlet

    fn encode_meshlet(vertices : FixedArray[UInt], vertex_count : Int, triangles : Bytes, triangle_count : Int) -> MeshoptData raise MeshoptError

    encode_meshlet_bound

    fn encode_meshlet_bound(max_vertices : Int, max_triangles : Int) -> Int raise MeshoptError

    encode_vertex_buffer

    fn encode_vertex_buffer(vertices : Bytes, vertex_count : Int, vertex_size : Int) -> MeshoptData raise MeshoptError

    encode_vertex_buffer_bound

    fn encode_vertex_buffer_bound(vertex_count : Int, vertex_size : Int) -> Int raise MeshoptError

    encode_vertex_buffer_level

    fn encode_vertex_buffer_level(vertices : Bytes, vertex_count : Int, vertex_size : Int, level : Int, version : Int) -> MeshoptData raise MeshoptError

    encode_vertex_version

    fn encode_vertex_version(version : Int) -> Unit raise MeshoptError

    extract_meshlet_indices

    fn extract_meshlet_indices(indices : FixedArray[UInt]) -> (FixedArray[UInt], Bytes, Int) raise MeshoptError

    generate_adjacency_index_buffer

    fn generate_adjacency_index_buffer(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int) -> FixedArray[UInt] raise MeshoptError

    generate_position_remap

    fn generate_position_remap(positions : FixedArray[Float], vertex_count : Int, positions_stride : Int) -> FixedArray[UInt] raise MeshoptError

    generate_provoking_index_buffer

    fn generate_provoking_index_buffer(indices : FixedArray[UInt], vertex_count : Int) -> ProvokingIndexBuffer raise MeshoptError

    generate_shadow_index_buffer

    fn generate_shadow_index_buffer(indices : FixedArray[UInt], vertices : Bytes, vertex_count : Int, vertex_size : Int, vertex_stride : Int) -> FixedArray[UInt] raise MeshoptError

    generate_shadow_index_buffer_multi

    fn generate_shadow_index_buffer_multi(indices : FixedArray[UInt], streams : PackedStreams, vertex_count : Int) -> FixedArray[UInt] raise MeshoptError

    generate_tangents

    fn generate_tangents(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, normals : FixedArray[Float], normals_stride : Int, uvs : FixedArray[Float], uvs_stride : Int, options? : TangentOptions) -> FixedArray[Float] raise MeshoptError

    generate_tessellation_index_buffer

    fn generate_tessellation_index_buffer(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int) -> FixedArray[UInt] raise MeshoptError

    generate_vertex_remap_custom

    fn generate_vertex_remap_custom(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, callback : (UInt, UInt) -> Bool) -> (FixedArray[UInt], Int) raise MeshoptError

    generate_vertex_remap_custom_no_callback

    fn generate_vertex_remap_custom_no_callback(positions : FixedArray[Float], vertex_count : Int, positions_stride : Int) -> (FixedArray[UInt], Int) raise MeshoptError

    generate_vertex_remap_indexed

    fn generate_vertex_remap_indexed(indices : FixedArray[UInt], vertices : Bytes, vertex_count : Int, vertex_size : Int) -> (FixedArray[UInt], Int) raise MeshoptError

    generate_vertex_remap_multi_indexed

    fn generate_vertex_remap_multi_indexed(indices : FixedArray[UInt], streams : PackedStreams, vertex_count : Int) -> (FixedArray[UInt], Int) raise MeshoptError

    generate_vertex_remap_multi_unindexed

    fn generate_vertex_remap_multi_unindexed(streams : PackedStreams, vertex_count : Int) -> (FixedArray[UInt], Int) raise MeshoptError

    generate_vertex_remap_unindexed

    fn generate_vertex_remap_unindexed(vertices : Bytes, vertex_count : Int, vertex_size : Int) -> (FixedArray[UInt], Int) raise MeshoptError

    opacity_map_compact

    fn opacity_map_compact(data : Bytes, levels : Bytes, offsets : FixedArray[UInt], omm_count : Int, omm_indices : FixedArray[Int], triangle_count : Int, states : Int) -> Int raise MeshoptError

    opacity_map_entry_size

    fn opacity_map_entry_size(level : Int, states : Int) -> Int raise MeshoptError

    opacity_map_measure

    fn opacity_map_measure(indices : FixedArray[UInt], uvs : FixedArray[Float], vertex_count : Int, uvs_stride : Int, texture_width : Int, texture_height : Int, max_level : Int, target_edge : Float) -> OpacityMapMeasure raise MeshoptError

    opacity_map_rasterize

    fn opacity_map_rasterize(level : Int, states : Int, uv0 : FixedArray[Float], uv1 : FixedArray[Float], uv2 : FixedArray[Float], texture_data : Bytes, texture_stride : Int, texture_pitch : Int, texture_width : Int, texture_height : Int) -> Bytes raise MeshoptError

    optimize_meshlet

    fn optimize_meshlet(meshlet_vertices : FixedArray[UInt], meshlet_triangles : Bytes, triangle_count : Int, vertex_count : Int) -> Unit raise MeshoptError

    optimize_meshlet_level

    fn optimize_meshlet_level(meshlet_vertices : FixedArray[UInt], meshlet_triangles : Bytes, triangle_count : Int, vertex_count : Int, level : Int) -> Unit raise MeshoptError

    optimize_overdraw

    fn optimize_overdraw(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, threshold? : Float) -> FixedArray[UInt] raise MeshoptError

    optimize_vertex_cache

    fn optimize_vertex_cache(indices : FixedArray[UInt], vertex_count : Int) -> FixedArray[UInt] raise MeshoptError

    optimize_vertex_cache_fifo

    fn optimize_vertex_cache_fifo(indices : FixedArray[UInt], vertex_count : Int, cache_size? : UInt) -> FixedArray[UInt] raise MeshoptError

    optimize_vertex_cache_strip

    fn optimize_vertex_cache_strip(indices : FixedArray[UInt], vertex_count : Int) -> FixedArray[UInt] raise MeshoptError

    optimize_vertex_fetch

    fn optimize_vertex_fetch(indices : FixedArray[UInt], vertices : Bytes, vertex_count : Int, vertex_size : Int) -> VertexFetchOptimization raise MeshoptError

    optimize_vertex_fetch_remap

    fn optimize_vertex_fetch_remap(indices : FixedArray[UInt], vertex_count : Int) -> (FixedArray[UInt], Int) raise MeshoptError

    partition_clusters

    fn partition_clusters(cluster_indices : FixedArray[UInt], cluster_index_counts : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, target_partition_size : Int) -> (FixedArray[UInt], Int) raise MeshoptError

    quantize_float

    fn quantize_float(value : Float, bits : Int) -> Float raise MeshoptError

    quantize_half

    fn quantize_half(value : Float) -> UInt

    quantize_snorm

    fn quantize_snorm(value : Float, bits : Int) -> Int raise MeshoptError

    quantize_unorm

    fn quantize_unorm(value : Float, bits : Int) -> Int raise MeshoptError

    remap_index_buffer_indexed

    fn remap_index_buffer_indexed(indices : FixedArray[UInt], remap : FixedArray[UInt]) -> FixedArray[UInt] raise MeshoptError

    remap_index_buffer_unindexed

    fn remap_index_buffer_unindexed(index_count : Int, remap : FixedArray[UInt]) -> FixedArray[UInt] raise MeshoptError

    remap_vertex_buffer

    fn remap_vertex_buffer(vertices : Bytes, vertex_count : Int, vertex_size : Int, unique_vertex_count : Int, remap : FixedArray[UInt]) -> Bytes raise MeshoptError

    simplify

    fn simplify(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, target_index_count : Int, target_error : Float, options? : SimplifyOptions) -> SimplifyResult raise MeshoptError

    simplify_points

    fn simplify_points(positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, target_vertex_count : Int, colors? : FixedArray[Float], colors_stride? : Int, color_weight? : Float) -> (FixedArray[UInt], Int) raise MeshoptError

    simplify_prune

    fn simplify_prune(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, target_error : Float) -> (FixedArray[UInt], Int) raise MeshoptError

    simplify_scale

    fn simplify_scale(positions : FixedArray[Float], vertex_count : Int, positions_stride : Int) -> Float raise MeshoptError

    simplify_sloppy

    fn simplify_sloppy(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, vertex_lock? : Bytes, target_index_count : Int, target_error : Float) -> SimplifyResult raise MeshoptError

    simplify_with_attributes

    fn simplify_with_attributes(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, attributes : FixedArray[Float], attributes_stride : Int, weights : FixedArray[Float], attribute_count : Int, vertex_lock? : Bytes, target_index_count : Int, target_error : Float, options? : SimplifyOptions) -> SimplifyResult raise MeshoptError

    simplify_with_update

    fn simplify_with_update(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, attributes? : FixedArray[Float], attributes_stride? : Int, weights? : FixedArray[Float], attribute_count? : Int, vertex_lock? : Bytes, target_index_count : Int, target_error : Float, options? : SimplifyOptions) -> (Int, Float) raise MeshoptError

    spatial_cluster_points

    fn spatial_cluster_points(positions : FixedArray[Float], vertex_count : Int, positions_stride : Int, cluster_size : Int) -> FixedArray[UInt] raise MeshoptError

    spatial_sort_remap

    fn spatial_sort_remap(positions : FixedArray[Float], vertex_count : Int, positions_stride : Int) -> FixedArray[UInt] raise MeshoptError

    spatial_sort_triangles

    fn spatial_sort_triangles(indices : FixedArray[UInt], positions : FixedArray[Float], vertex_count : Int, positions_stride : Int) -> FixedArray[UInt] raise MeshoptError

    stripify_bound

    fn stripify_bound(index_count : Int) -> Int raise MeshoptError

    stripify_indices

    fn stripify_indices(indices : FixedArray[UInt], vertex_count : Int, restart_index? : UInt) -> (FixedArray[UInt], Int) raise MeshoptError

    unstripify_bound

    fn unstripify_bound(index_count : Int) -> Int raise MeshoptError

    unstripify_indices

    fn unstripify_indices(indices : FixedArray[UInt], restart_index? : UInt) -> (FixedArray[UInt], Int) raise MeshoptError

    version

    let version : Int