Skip to content

reearth/draco-oxide

Repository files navigation

draco-oxide

Crates.io Documentation

draco-oxide is a high-performance Rust re-write of Google’s Draco 3D-mesh compression library, featuring efficient streaming I/O and seamless WebAssembly integration.

Status: Alpha – Encoder is functional; decoder implementation is work‑in‑progress.


Features

Component Alpha Beta Roadmap
Mesh Encoder Performance optimization
Mesh Decoder
glTF Transcoder (basic) Animation and many more extensions

Encoder Highlights

  • Triangle‑mesh compression with configurable speed/ratio presets.
  • Basic glTF transcoder (*.gltf or *.glb → *.glb with mesh buffer compressed via KHR_draco_mesh_compression extension).
  • Pure‑Rust implementation.
  • no_std + alloc compatible; builds to WASM32, x86_64, aarch64, and more.

Decoder (Coming Soon)

Planned for the beta milestone.


Getting Started

Add to Your Project

draco-oxide = "0.1.0-alpha.1"

Example: Encode an obj file.

use draco_oxide::{encode::{self, encode}, io::obj::load_obj};
use draco_oxide::prelude::ConfigType;
use std::io::Write;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create mesh from an obj file, for example.
    let mesh = load_obj("mesh.obj").unwrap();

    // Create a buffer that we write the encoded data to.
    // This time we use 'Vec<u8>' as the output buffer, but 
    // draco-oxide can stream-write to anything 
    // that implements 'draco_oxide::prelude::ByteWriter'.
    let mut buffer = Vec::new();
    
    // Encode the mesh into the buffer.
    encode(mesh, &mut buffer, encode::Config::default()).unwrap();

    let mut file = std::fs::File::create("output.drc").unwrap();
    file.write_all(&buffer)?;
    Ok(())
}

See the draco-oxide/examples directory for more.

CLI

# compress input.obj into a draco file output.drc
cargo run --bin cli -- -i path/to/input.obj -o path/to/output.drc

# transcode input.glb into a draco compressed glb file output.glb as specified 
# in KHR_draco_mesh_compression extension.
cargo run --bin cli -- --transcode -i path/to/input.glb -o path/to/output.glb

Roadmap to Beta

  • Decoder Support.
  • Complete glTF support.

Acknowledgements

  • Google Draco – original C++ implementation

Contact

Re:Earth core committers: [email protected]


License

Licensed under either (at your discretion):

About

Rust crate for the Google Draco mesh compression library (WIP)

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •