pub struct LodMesh {
pub levels: Vec<GpuMesh>,
pub thresholds: Vec<f32>,
}Expand description
Pre-computed LOD levels for a mesh, generated from a progressive mesh.
Levels are ordered from coarsest (index 0) to finest (last index).
Use select_level to pick the appropriate LOD for a given camera distance.
Fields§
§levels: Vec<GpuMesh>GPU meshes at each LOD level, index 0 = coarsest
thresholds: Vec<f32>Distance thresholds for switching between levels.
thresholds[i] is the maximum distance at which levels[i+1] should be used.
Implementations§
Source§impl LodMesh
impl LodMesh
Sourcepub fn from_progressive_mesh(pm: &ProgressiveMesh, num_levels: usize) -> Self
pub fn from_progressive_mesh(pm: &ProgressiveMesh, num_levels: usize) -> Self
Create LOD levels by sampling the progressive mesh at evenly-spaced detail ratios.
num_levels is the total number of LOD levels to generate (minimum 2).
Sourcepub fn select_level(&self, distance: f32) -> &GpuMesh
pub fn select_level(&self, distance: f32) -> &GpuMesh
Select the appropriate LOD level for a given camera distance.
Returns the coarsest mesh that still looks acceptable at the given distance. Closer distances get finer detail; farther distances get coarser meshes.
Sourcepub fn num_levels(&self) -> usize
pub fn num_levels(&self) -> usize
Number of LOD levels.
Auto Trait Implementations§
impl Freeze for LodMesh
impl RefUnwindSafe for LodMesh
impl Send for LodMesh
impl Sync for LodMesh
impl Unpin for LodMesh
impl UnsafeUnpin for LodMesh
impl UnwindSafe for LodMesh
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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.