pub struct Terrain<M: Material> { /* private fields */ }Expand description
A terrain geometry based on a height map and with an applied material.
Implementations§
Source§impl<M: Material + Clone> Terrain<M>
impl<M: Material + Clone> Terrain<M>
Sourcepub fn new(
context: &Context,
material: M,
height_map: Arc<dyn Fn(f32, f32) -> f32 + Send + Sync>,
side_length: f32,
vertex_distance: f32,
center: Vec2,
) -> Self
pub fn new( context: &Context, material: M, height_map: Arc<dyn Fn(f32, f32) -> f32 + Send + Sync>, side_length: f32, vertex_distance: f32, center: Vec2, ) -> Self
Creates a new Terrain. The height map is a function of the (x, z) coordinates which returns the height of the terrain y.
Sourcepub fn set_lod(&mut self, lod: Arc<dyn Fn(f32) -> Lod + Send + Sync>)
pub fn set_lod(&mut self, lod: Arc<dyn Fn(f32) -> Lod + Send + Sync>)
Set the function that specifies when a certain level of detail Lod is uses. The input to the function is the distance from the current camera to the center of a part of the terrain.
Sourcepub fn set_center(&mut self, center: Vec2)
pub fn set_center(&mut self, center: Vec2)
Set the center of the terrain. To be able to move the terrain with the camera, thereby simulating infinite terrain.
Trait Implementations§
Source§impl<'a, M: Material> IntoIterator for &'a Terrain<M>
impl<'a, M: Material> IntoIterator for &'a Terrain<M>
Auto Trait Implementations§
impl<M> Freeze for Terrain<M>where
M: Freeze,
impl<M> !RefUnwindSafe for Terrain<M>
impl<M> Send for Terrain<M>where
M: Send,
impl<M> Sync for Terrain<M>where
M: Sync,
impl<M> Unpin for Terrain<M>where
M: Unpin,
impl<M> !UnwindSafe for Terrain<M>
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