pub struct GltfPrimitive {
pub positions: Vec<[f32; 3]>,
pub normals: Vec<[f32; 3]>,
pub texcoords: Vec<[f32; 2]>,
pub indices: Vec<u32>,
}Expand description
A single draw primitive: positions, normals, and indices.
Fields§
§positions: Vec<[f32; 3]>Per-vertex positions.
normals: Vec<[f32; 3]>Per-vertex normals.
texcoords: Vec<[f32; 2]>Per-vertex UV texture coordinates (TEXCOORD_0).
indices: Vec<u32>Triangle indices.
Implementations§
Source§impl GltfPrimitive
impl GltfPrimitive
Sourcepub fn bounding_box(&self) -> ([f32; 3], [f32; 3])
pub fn bounding_box(&self) -> ([f32; 3], [f32; 3])
Compute the axis-aligned bounding box of positions.
Returns (min, max) as [f32; 3] arrays.
Sourcepub fn triangle_count(&self) -> usize
pub fn triangle_count(&self) -> usize
Return the number of triangles (indices / 3).
Sourcepub fn vertex_count(&self) -> usize
pub fn vertex_count(&self) -> usize
Return the number of vertices.
Auto Trait Implementations§
impl Freeze for GltfPrimitive
impl RefUnwindSafe for GltfPrimitive
impl Send for GltfPrimitive
impl Sync for GltfPrimitive
impl Unpin for GltfPrimitive
impl UnsafeUnpin for GltfPrimitive
impl UnwindSafe for GltfPrimitive
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.