pub struct TriMesh {
pub positions: Vec<Point3>,
pub indices: Vec<u32>,
pub normals: Option<NormalAttribute>,
pub attributes: Vec<AttributeChannel>,
}Expand description
Indexed triangle mesh in local coordinates.
Dirty source geometry is representable. Call TriMesh::validate_structure
at trust boundaries; manifold validation is a separate, more expensive pass.
Fields§
§positions: Vec<Point3>Vertex positions.
indices: Vec<u32>Triangle corner indices, three entries per triangle.
normals: Option<NormalAttribute>Optional normals preserved from the source.
attributes: Vec<AttributeChannel>Named per-vertex channels carried alongside positions.
Empty by default: a mesh with no extra data pays nothing for this.
Implementations§
Source§impl TriMesh
impl TriMesh
Sourcepub fn new(positions: Vec<Point3>, indices: Vec<u32>) -> Self
pub fn new(positions: Vec<Point3>, indices: Vec<u32>) -> Self
Construct a position/index mesh without normals.
Sourcepub fn triangle_count(&self) -> usize
pub fn triangle_count(&self) -> usize
Number of complete triangles.
Sourcepub fn validate_structure(&self) -> Result<(), MeshValidationError>
pub fn validate_structure(&self) -> Result<(), MeshValidationError>
Cheap index-buffer and attribute-size validation.
Sourcepub fn is_structurally_valid(&self) -> bool
pub fn is_structurally_valid(&self) -> bool
Whether cheap structural validation succeeds.
Sourcepub fn triangles(&self) -> impl ExactSizeIterator<Item = [u32; 3]> + '_
pub fn triangles(&self) -> impl ExactSizeIterator<Item = [u32; 3]> + '_
Triangles in deterministic index-buffer order.
Trait Implementations§
Source§impl TriangleMeshView for TriMesh
impl TriangleMeshView for TriMesh
Source§fn position_count(&self) -> usize
fn position_count(&self) -> usize
Number of addressable positions.
Source§fn triangle_count(&self) -> usize
fn triangle_count(&self) -> usize
Number of complete triangle records.
impl StructuralPartialEq for TriMesh
Auto Trait Implementations§
impl Freeze for TriMesh
impl RefUnwindSafe for TriMesh
impl Send for TriMesh
impl Sync for TriMesh
impl Unpin for TriMesh
impl UnwindSafe for TriMesh
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