pub struct ProgressiveMesh {
pub base_mesh: TriangleMesh,
pub vertex_splits: Vec<VertexSplit>,
pub full_vertex_count: usize,
pub full_face_count: usize,
}Expand description
Progressive mesh: a base mesh plus a sequence of vertex splits.
The base mesh is the coarsest representation. Applying vertex splits in order progressively refines the mesh back toward the original.
Fields§
§base_mesh: TriangleMeshThe coarsest level of detail
vertex_splits: Vec<VertexSplit>Ordered sequence of vertex split operations (apply in order to refine)
full_vertex_count: usizeTotal vertex count of the original (fully refined) mesh
full_face_count: usizeTotal face count of the original (fully refined) mesh
Implementations§
Source§impl ProgressiveMesh
impl ProgressiveMesh
Sourcepub fn from_mesh(mesh: &TriangleMesh, base_face_ratio: f32) -> Result<Self>
pub fn from_mesh(mesh: &TriangleMesh, base_face_ratio: f32) -> Result<Self>
Generate a progressive mesh by simplifying the input mesh down to a base level, recording each edge collapse as a reversible vertex split.
base_face_ratio controls how much to simplify: 0.1 means the base
mesh will have ~10% of the original faces.
Sourcepub fn reconstruct_at_level(&self, level: usize) -> TriangleMesh
pub fn reconstruct_at_level(&self, level: usize) -> TriangleMesh
Reconstruct the mesh at a specific refinement level.
level is clamped to [0, num_levels()]. Level 0 is the base mesh,
num_levels() is full detail.
Sourcepub fn reconstruct_at_ratio(&self, detail_ratio: f32) -> TriangleMesh
pub fn reconstruct_at_ratio(&self, detail_ratio: f32) -> TriangleMesh
Reconstruct the mesh at a given detail ratio.
detail_ratio ranges from 0.0 (base/coarsest) to 1.0 (full detail).
Sourcepub fn base(&self) -> &TriangleMesh
pub fn base(&self) -> &TriangleMesh
Get a reference to the base (coarsest) mesh.
Sourcepub fn num_levels(&self) -> usize
pub fn num_levels(&self) -> usize
Number of refinement levels (vertex splits) available.
Sourcepub fn serialize_to_bytes(&self) -> Result<Vec<u8>>
pub fn serialize_to_bytes(&self) -> Result<Vec<u8>>
Serialize the progressive mesh to bytes using bincode.
Sourcepub fn deserialize_from_bytes(data: &[u8]) -> Result<Self>
pub fn deserialize_from_bytes(data: &[u8]) -> Result<Self>
Deserialize a progressive mesh from bytes.
Trait Implementations§
Source§impl Clone for ProgressiveMesh
impl Clone for ProgressiveMesh
Source§fn clone(&self) -> ProgressiveMesh
fn clone(&self) -> ProgressiveMesh
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProgressiveMesh
impl Debug for ProgressiveMesh
Source§impl<'de> Deserialize<'de> for ProgressiveMesh
impl<'de> Deserialize<'de> for ProgressiveMesh
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ProgressiveMesh
impl RefUnwindSafe for ProgressiveMesh
impl Send for ProgressiveMesh
impl Sync for ProgressiveMesh
impl Unpin for ProgressiveMesh
impl UnsafeUnpin for ProgressiveMesh
impl UnwindSafe for ProgressiveMesh
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
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.