pub struct ObjMesh {
pub vertices: Vec<[f64; 3]>,
pub normals: Vec<[f64; 3]>,
pub uvs: Vec<[f64; 2]>,
pub faces: Vec<ObjFace>,
pub groups: Vec<ObjGroup>,
}Expand description
A Wavefront OBJ mesh with vertices, normals, UVs, and faces.
Fields§
§vertices: Vec<[f64; 3]>3D vertex positions.
normals: Vec<[f64; 3]>Per-vertex normals.
uvs: Vec<[f64; 2]>UV (texture) coordinates.
faces: Vec<ObjFace>Face list.
groups: Vec<ObjGroup>Named groups.
Implementations§
Source§impl ObjMesh
impl ObjMesh
Sourcepub fn to_triangle_soup(&self) -> Vec<[[f64; 3]; 3]>
pub fn to_triangle_soup(&self) -> Vec<[[f64; 3]; 3]>
Extract a flat triangle soup from the mesh.
Each triangle is [[v0\], [v1], [v2]] in world-space coordinates.
Quad faces are triangulated as (0,1,2) and (0,2,3).
Sourcepub fn faces_in_group(&self, group_name: &str) -> Vec<&ObjFace>
pub fn faces_in_group(&self, group_name: &str) -> Vec<&ObjFace>
Return faces belonging to a specific group.
Sourcepub fn faces_in_smoothing_group(&self, sg: u32) -> Vec<&ObjFace>
pub fn faces_in_smoothing_group(&self, sg: u32) -> Vec<&ObjFace>
Return faces belonging to a specific smoothing group.
Sourcepub fn faces_with_material(&self, mat_name: &str) -> Vec<&ObjFace>
pub fn faces_with_material(&self, mat_name: &str) -> Vec<&ObjFace>
Return faces with a specific material.
Sourcepub fn triangle_count(&self) -> usize
pub fn triangle_count(&self) -> usize
Total number of triangles after fan-triangulation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ObjMesh
impl RefUnwindSafe for ObjMesh
impl Send for ObjMesh
impl Sync for ObjMesh
impl Unpin for ObjMesh
impl UnsafeUnpin for ObjMesh
impl UnwindSafe for ObjMesh
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.