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.
Component | Alpha | Beta Roadmap |
---|---|---|
Mesh Encoder | ✅ | Performance optimization |
Mesh Decoder | ❌ | ✅ |
glTF Transcoder (basic) | ✅ | Animation and many more extensions |
- 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.
Planned for the beta milestone.
draco-oxide = "0.1.0-alpha.1"
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.
# 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
- Decoder Support.
- Complete glTF support.
- Google Draco – original C++ implementation
Re:Earth core committers: [email protected]
Licensed under either (at your discretion):
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)