pub struct TerrainHeightmap {
pub width: usize,
pub height: usize,
pub heights: Vec<f32>,
pub cell_size: f32,
pub origin: Vec2,
pub min_height: f32,
pub max_height: f32,
pub scale_y: f32,
}Fields§
§width: usize§height: usize§heights: Vec<f32>§cell_size: f32§origin: Vec2§min_height: f32§max_height: f32§scale_y: f32Implementations§
Source§impl TerrainHeightmap
impl TerrainHeightmap
pub fn new( width: usize, height: usize, cell_size: f32, origin: Vec2, scale_y: f32, ) -> Self
pub fn set_height(&mut self, x: usize, z: usize, h: f32)
pub fn get_height(&self, x: usize, z: usize) -> f32
pub fn sample_bilinear(&self, world_x: f32, world_z: f32) -> f32
pub fn compute_normal(&self, x: usize, z: usize) -> Vec3
pub fn compute_normal_bilinear(&self, world_x: f32, world_z: f32) -> Vec3
pub fn slope_at(&self, world_x: f32, world_z: f32) -> f32
pub fn curvature_at(&self, x: usize, z: usize) -> f32
pub fn bounds(&self) -> ChunkBounds
pub fn generate_flat( width: usize, height: usize, cell_size: f32, origin: Vec2, ) -> Self
pub fn generate_sinusoidal( width: usize, height: usize, cell_size: f32, origin: Vec2, amplitude: f32, frequency: f32, ) -> Self
Trait Implementations§
Source§impl Clone for TerrainHeightmap
impl Clone for TerrainHeightmap
Auto Trait Implementations§
impl Freeze for TerrainHeightmap
impl RefUnwindSafe for TerrainHeightmap
impl Send for TerrainHeightmap
impl Sync for TerrainHeightmap
impl Unpin for TerrainHeightmap
impl UnsafeUnpin for TerrainHeightmap
impl UnwindSafe for TerrainHeightmap
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.