Skip to main content

EncoderOptions

Struct EncoderOptions 

Source
pub struct EncoderOptions { /* private fields */ }
Available on crate feature encoder only.
Expand description

Integer option bag used to configure Draco encoding.

Options mirror the C++ Draco encoder style: global options apply to the whole geometry, while attribute options override a value for one attribute id and fall back to the global value when unset.

Common keys include quantization_bits (per-attribute precision), encoding_speed/decoding_speed, encoding_method, and prediction_scheme. Keys without an explicit setter are read and written with get_global_int / set_global_int.

§Examples

use draco_core::EncoderOptions;

let mut options = EncoderOptions::new();
options.set_global_int("quantization_bits", 14); // default for all attributes
options.set_attribute_int(0, "quantization_bits", 10); // override attribute 0

assert_eq!(options.get_attribute_int(0, "quantization_bits", 0), 10);
// Attribute 1 has no override, so it falls back to the global value.
assert_eq!(options.get_attribute_int(1, "quantization_bits", 0), 14);

Implementations§

Source§

impl EncoderOptions

Source

pub fn new() -> Self

Creates options with Draco-compatible defaults.

Source

pub fn get_encoding_speed(&self) -> i32

Returns the configured encoding speed, defaulting to 5.

Source

pub fn get_decoding_speed(&self) -> i32

Returns the configured decoding speed target, defaulting to 5.

Source

pub fn get_speed(&self) -> i32

Returns the maximum speed for both encoding/decoding. Matches C++ ExpertEncoder::GetSpeed() behavior.

Source

pub fn get_prediction_scheme(&self) -> i32

Returns the forced prediction scheme, or -1 for the encoder default.

Source

pub fn set_prediction_scheme(&mut self, value: i32)

Forces a prediction scheme by numeric Draco method id.

Source

pub fn get_encoding_method(&self) -> Option<i32>

Returns the forced encoding method, if one was set.

Source

pub fn set_encoding_method(&mut self, value: i32)

Forces an encoding method by numeric Draco method id.

Source

pub fn set_version(&mut self, major: u8, minor: u8)

Sets the target Draco bitstream version.

Source

pub fn get_version(&self) -> (u8, u8)

Returns the target Draco bitstream version, or (0, 0) for default.

Source

pub fn set_global_int(&mut self, key: &str, value: i32)

Sets a global integer option.

Source

pub fn get_global_int(&self, key: &str, default_val: i32) -> i32

Returns a global integer option or the supplied default.

Source

pub fn set_attribute_int(&mut self, att_id: i32, key: &str, value: i32)

Sets an integer option for one attribute id.

Source

pub fn get_attribute_int(&self, att_id: i32, key: &str, default_val: i32) -> i32

Returns an attribute integer option, falling back to the global value.

Trait Implementations§

Source§

impl Clone for EncoderOptions

Source§

fn clone(&self) -> EncoderOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EncoderOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EncoderOptions

Source§

fn default() -> EncoderOptions

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.