pub struct VegetationSystem {
pub instances: Vec<VegetationInstance>,
pub grass_field: GrassField,
pub rock_clusters: Vec<RockCluster>,
pub wind_vector: Vec2,
pub time: f32,
}Expand description
Top-level manager for all vegetation instances.
Fields§
§instances: Vec<VegetationInstance>§grass_field: GrassField§rock_clusters: Vec<RockCluster>§wind_vector: Vec2§time: f32Implementations§
Source§impl VegetationSystem
impl VegetationSystem
pub fn new() -> Self
Sourcepub fn generate(
heightmap: &HeightMap,
biome_map: &BiomeMap,
density_scale: f32,
seed: u64,
) -> Self
pub fn generate( heightmap: &HeightMap, biome_map: &BiomeMap, density_scale: f32, seed: u64, ) -> Self
Generate all vegetation from a heightmap and biome map.
Sourcepub fn update_lod(&mut self, camera_pos: Vec3)
pub fn update_lod(&mut self, camera_pos: Vec3)
Update LOD levels for all instances based on camera position.
Sourcepub fn frustum_cull(&mut self, planes: &[(Vec3, f32); 6])
pub fn frustum_cull(&mut self, planes: &[(Vec3, f32); 6])
Frustum cull instances. planes is 6 plane normal+distance pairs.
Sourcepub fn apply_season(&mut self, month: u32)
pub fn apply_season(&mut self, month: u32)
Apply seasonal variation to all instances.
Sourcepub fn visible_count(&self) -> usize
pub fn visible_count(&self) -> usize
Count visible instances.
Sourcepub fn instances_at_lod(
&self,
lod: u8,
) -> impl Iterator<Item = &VegetationInstance>
pub fn instances_at_lod( &self, lod: u8, ) -> impl Iterator<Item = &VegetationInstance>
Get all visible instances at a given LOD level.
Trait Implementations§
Source§impl Debug for VegetationSystem
impl Debug for VegetationSystem
Auto Trait Implementations§
impl Freeze for VegetationSystem
impl RefUnwindSafe for VegetationSystem
impl Send for VegetationSystem
impl Sync for VegetationSystem
impl Unpin for VegetationSystem
impl UnsafeUnpin for VegetationSystem
impl UnwindSafe for VegetationSystem
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
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.