pub struct Mesh3d { /* private fields */ }Expand description
Immutable validated topology for retained stereometry rendering.
Vertices use caller-defined model-space world units. Triangle indices are a flat triangle list. Winding is preserved but deliberately not interpreted: the current surface pass disables face culling, and a global “counter-clockwise” rule is meaningless without a declared outward side. Optional display edges identify the mathematical edges that a later visible/hidden-line pass should draw; they are not inferred from triangle adjacency because triangulation diagonals are not necessarily meaningful construction edges. A mesh may contain surfaces, display edges, or both.
Implementations§
Source§impl Mesh3d
impl Mesh3d
Sourcepub fn new(
vertices: Vec<Vec3>,
triangle_indices: Vec<u32>,
) -> Result<Self, Mesh3dError>
pub fn new( vertices: Vec<Vec3>, triangle_indices: Vec<u32>, ) -> Result<Self, Mesh3dError>
Builds a surface mesh without explicit display edges.
Sourcepub fn with_display_edges(
vertices: Vec<Vec3>,
triangle_indices: Vec<u32>,
display_edges: Vec<MeshEdge3d>,
) -> Result<Self, Mesh3dError>
pub fn with_display_edges( vertices: Vec<Vec3>, triangle_indices: Vec<u32>, display_edges: Vec<MeshEdge3d>, ) -> Result<Self, Mesh3dError>
Builds a mesh with explicit mathematical display edges.
Construction rejects an empty vertex set, geometry with neither triangles nor display edges, incomplete triangle lists, out-of-range indices, repeated/collinear triangle vertices, duplicate display edges, display edges with coincident endpoints, and display edges outside the vertex array.
Sourcepub fn triangle_indices(&self) -> &[u32]
pub fn triangle_indices(&self) -> &[u32]
Returns the flat host-wound triangle index list.
Sourcepub fn display_edges(&self) -> &[MeshEdge3d]
pub fn display_edges(&self) -> &[MeshEdge3d]
Returns explicit mathematical edges, excluding triangulation diagonals.
Sourcepub fn triangle_count(&self) -> usize
pub fn triangle_count(&self) -> usize
Returns the number of retained triangles.
Sourcepub const fn bounds_min(&self) -> Vec3
pub const fn bounds_min(&self) -> Vec3
Returns the inclusive model-space lower bound.
Sourcepub const fn bounds_max(&self) -> Vec3
pub const fn bounds_max(&self) -> Vec3
Returns the inclusive model-space upper bound.
Sourcepub fn recovery_memory_bytes(&self) -> usize
pub fn recovery_memory_bytes(&self) -> usize
Returns retained CPU bytes used by vertices, indices, and display edges.