Type Alias TerrainSegment

Source
pub type TerrainSegment = Dyna<Block, ()>;

Aliased Type§

struct TerrainSegment {
    vox: Vec<Block>,
    meta: (),
    pub sz: Vec3<u32>,
    _phantom: PhantomData<ColumnAccess>,
}

Fields§

§vox: Vec<Block>§meta: ()§sz: Vec3<u32>§_phantom: PhantomData<ColumnAccess>

Implementations

Source§

impl<V: Clone, M, A: Access> Dyna<V, M, A>

Source

pub fn filled(sz: Vec3<u32>, vox: V, meta: M) -> Self

Create a new Dyna with the provided dimensions and all voxels filled with duplicates of the provided voxel.

Source

pub fn from_fn<F: FnMut(Vec3<i32>) -> V>(sz: Vec3<u32>, meta: M, f: F) -> Self

Same as Dyna::filled, but with the voxel determined by the function f.

Source

pub fn metadata(&self) -> &M

Get a reference to the internal metadata.

Source

pub fn metadata_mut(&mut self) -> &mut M

Get a mutable reference to the internal metadata.

Source§

impl<V, M, A: Access> Dyna<V, M, A>

Source

fn idx_for(sz: Vec3<u32>, pos: Vec3<i32>) -> Option<usize>

Used to transform a voxel position in the volume into its corresponding index in the voxel array.

Source

pub fn map_into<W, F: FnMut(V) -> W>(self, f: F) -> Dyna<W, M, A>

Trait Implementations§

Source§

impl From<Dyna<Cell, ()>> for TerrainSegment

Source§

fn from(value: Segment) -> Self

Converts to this type from the input type.
Source§

impl<V, M, A: Access> BaseVol for Dyna<V, M, A>

Source§

type Error = DynaError

Source§

type Vox = V

Source§

fn scaled_by(self, scale: Vec3<f32>) -> Scaled<Self>
where Self: Sized,

Source§

impl<V: Clone, M: Clone, A: Access> Clone for Dyna<V, M, A>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V: Debug, M: Debug, A: Debug + Access> Debug for Dyna<V, M, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, V, M, A: Access> Deserialize<'de> for Dyna<V, M, A>
where V: Deserialize<'de>, M: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<V, M, A: Access> ReadVol for Dyna<V, M, A>

Source§

fn get(&self, pos: Vec3<i32>) -> Result<&V, DynaError>

Get a reference to the voxel at the provided position in the volume.
Source§

fn get_unchecked(&self, pos: Vec3<i32>) -> &Self::Vox

Get a reference to the voxel at the provided position in the volume. Many volumes provide a fast path, provided the position is always in-bounds. Note that this function is still safe.
Source§

fn ray( &self, from: Vec3<f32>, to: Vec3<f32>, ) -> Ray<'_, Self, fn(&Self::Vox) -> bool, fn(&Self::Vox, Vec3<i32>)>
where Self: Sized,

NOTE: By default, this ray will simply run from from to to without stopping. To make something interesting happen, call until or for_each.
Source§

fn for_each_in(&self, aabb: Aabb<i32>, f: impl FnMut(Vec3<i32>, Self::Vox))
where Self::Vox: Copy,

Call provided closure with each block in the supplied Aabb Portions of the Aabb outside the volume are ignored
Source§

impl<V, M, A: Access> Serialize for Dyna<V, M, A>
where V: Serialize, M: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<V, M, A: Access> SizedVol for Dyna<V, M, A>

Source§

fn lower_bound(&self) -> Vec3<i32>

Returns the (inclusive) lower bound of the volume.
Source§

fn upper_bound(&self) -> Vec3<i32>

Returns the (exclusive) upper bound of the volume.
Source§

fn size(&self) -> Vec3<u32>

Returns the size of the volume.
Source§

impl<V, M, A: Access> WriteVol for Dyna<V, M, A>

Source§

fn set( &mut self, pos: Vec3<i32>, vox: Self::Vox, ) -> Result<Self::Vox, DynaError>

Set the voxel at the provided position in the volume to the provided value.
Source§

fn map<F: FnOnce(Self::Vox) -> Self::Vox>( &mut self, pos: Vec3<i32>, f: F, ) -> Result<Self::Vox, Self::Error>
where Self: ReadVol, Self::Vox: Clone,

Map a voxel to another using the provided function.