pub struct ObjMesh<'a> { /* private fields */ }Expand description
A borrowed OBJ mesh view over the original text input.
Implementations§
Source§impl<'a> ObjMesh<'a>
impl<'a> ObjMesh<'a>
Sourcepub const fn vertex_count(self) -> usize
pub const fn vertex_count(self) -> usize
Returns the number of parsed v records.
Sourcepub const fn face_count(self) -> usize
pub const fn face_count(self) -> usize
Returns the number of parsed triangular f records.
Sourcepub fn vertex(self, index: usize) -> Result<ObjVertex, ObjError>
pub fn vertex(self, index: usize) -> Result<ObjVertex, ObjError>
Reads the requested vertex from the borrowed source.
This performs a linear scan from the start of the source. Use
ObjMesh::vertices for full-mesh iteration.
§Errors
Returns ObjError::IndexOutOfBounds if the index is out of range.
Sourcepub fn triangle(self, index: usize) -> Result<Triangle32, ObjError>
pub fn triangle(self, index: usize) -> Result<Triangle32, ObjError>
Reads the requested triangle from the borrowed source.
This performs a linear scan from the start of the source. Use
ObjMesh::triangles for full-mesh iteration.
§Errors
Returns ObjError::IndexOutOfBounds if the index is out of range,
or another ObjError if the face record is invalid.
Sourcepub fn vertices(self) -> ObjVertices<'a> ⓘ
pub fn vertices(self) -> ObjVertices<'a> ⓘ
Returns a forward iterator over decoded OBJ vertex records.
The iterator scans the borrowed source once and does not allocate.
Sourcepub fn triangles(self) -> ObjTriangles<'a> ⓘ
pub fn triangles(self) -> ObjTriangles<'a> ⓘ
Returns a forward iterator over decoded OBJ triangle face records.
The iterator scans the borrowed source once and does not allocate.