draco-oxide-core 0.1.0-alpha.7

Shared core for draco-oxide: the geometry/attribute data model, numeric primitives, and the compression algorithms shared between the encoder and decoder.
Documentation
pub mod connectivity;

pub mod attribute;

pub mod entropy;

pub mod header {
    use crate::bit_coder::{ByteReader, ByteWriter, ReaderErr};

    #[derive(Debug, Clone, Copy, PartialEq)]
    pub enum EncoderMethod {
        Edgebreaker,
        #[allow(unused)]
        Sequential,
    }

    impl EncoderMethod {
        #[inline]
        #[allow(unused)]
        pub fn read_from<R>(reader: &mut R) -> Result<Self, ReaderErr>
        where
            R: ByteReader,
        {
            match reader.read_u8()? {
                0 => Ok(EncoderMethod::Sequential),
                1 => Ok(EncoderMethod::Edgebreaker),
                _ => panic!("Unknown encoder method ID"),
            }
        }

        #[inline]
        pub fn write_to<W>(self, writer: &mut W)
        where
            W: ByteWriter,
        {
            match self {
                EncoderMethod::Sequential => writer.write_u8(0),
                EncoderMethod::Edgebreaker => writer.write_u8(1),
            }
        }
    }
}