pub struct PackedAttribute { /* private fields */ }Expand description
One materialized, tightly packed vertex attribute.
use draco_gltf::{ComponentType, PackedAttribute};
let position = PackedAttribute::new(
"POSITION",
1,
3,
ComponentType::F32,
false,
vec![0; 12],
)?;
assert_eq!(position.count(), 1);Implementations§
Source§impl PackedAttribute
impl PackedAttribute
Sourcepub fn new(
semantic: impl Into<String>,
count: usize,
components: u8,
component_type: ComponentType,
normalized: bool,
bytes: Vec<u8>,
) -> Result<Self, GeometryError>
pub fn new( semantic: impl Into<String>, count: usize, components: u8, component_type: ComponentType, normalized: bool, bytes: Vec<u8>, ) -> Result<Self, GeometryError>
Creates and validates a tightly packed vertex attribute.
Sourcepub fn with_source_accessor(self, accessor: usize) -> Self
pub fn with_source_accessor(self, accessor: usize) -> Self
Records which document accessor these bytes were materialized from.
Primitives routinely share one accessor — a mesh split by material is the usual case — and a consumer that rebuilds its own buffers has no other way to notice, since the bytes arrive already materialized. Left unset for compressed geometry, whose bytes come from the codec stream rather than from the accessor the attribute names.
Sourcepub const fn source_accessor(&self) -> Option<usize>
pub const fn source_accessor(&self) -> Option<usize>
Returns the document accessor these bytes came from, when known.
Sourcepub const fn components(&self) -> u8
pub const fn components(&self) -> u8
Returns the number of scalar components in each element.
Sourcepub const fn component_type(&self) -> ComponentType
pub const fn component_type(&self) -> ComponentType
Returns the scalar storage type.
Sourcepub const fn normalized(&self) -> bool
pub const fn normalized(&self) -> bool
Returns whether integer values use normalized interpretation.
Trait Implementations§
Source§impl Clone for PackedAttribute
impl Clone for PackedAttribute
Source§fn clone(&self) -> PackedAttribute
fn clone(&self) -> PackedAttribute
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PackedAttribute
impl Debug for PackedAttribute
impl Eq for PackedAttribute
Source§impl PartialEq for PackedAttribute
Equality is over the vertex data, not over where it was read from.
impl PartialEq for PackedAttribute
Equality is over the vertex data, not over where it was read from.
source_accessor records provenance: the same bytes materialized from a
different document, or re-materialized after a write, are the same
attribute, and a round-trip that renumbers accessors has lost nothing.