encode

Function encode 

Source
pub fn encode<W>(mesh: Mesh, writer: &mut W, cfg: Config) -> Result<(), Err>
where W: ByteWriter,
Expand description

Encodes the input mesh into a provided byte stream using the provided configuration.

Examples found in repository?
examples/obj.rs (line 18)
8fn main() -> Result<(), Box<dyn std::error::Error>> {
9    // Create mesh from an obj file, for example.
10    let mesh = load_obj("mesh.obj").unwrap();
11
12    // Create a buffer that we write the encoded data to.
13    // This time we use 'Vec<u8>' as the output buffer, but draco-oxide can stream-write to anything
14    // that implements draco_oxide::prelude::ByteWriter.
15    let mut buffer = Vec::new();
16
17    // Encode the mesh into the buffer.
18    encode(mesh, &mut buffer, encode::Config::default()).unwrap();
19
20    let mut file = std::fs::File::create("output.drc").unwrap();
21    file.write_all(&buffer)?;
22    Ok(())
23}