Draco mesh and point cloud decoder in MoonBit, decoding as draco3d 1.5.7 does
moon add t-ujiie-g/draco/// The triangle count and the bytes of the attribute glTF names with `id`.
fn read(bytes : FixedArray[Byte], id : Int) -> (Int, FixedArray[Byte])? {
guard @draco.decode(bytes, 0, bytes.length()) is Some(mesh) else { return None }
guard mesh.attribute(id) is Some(attribute) else { return None }
Some((mesh.indices.length() / 3, attribute.data))
}pub struct DracoAttribute {
unique_id : Int
attribute_type : Int
data_type : Int
num_components : Int
normalized : Bool
data : FixedArray[Byte]
}pub struct DracoMesh {
indices : FixedArray[Int]
num_points : Int
attributes : Array[DracoAttribute]
}let MAX_KD_DIMENSIONS : IntInstall
Download zipDraco mesh and point cloud decoder in MoonBit, decoding as draco3d 1.5.7 does