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>
impl<V: Clone, M, A: Access> Dyna<V, M, A>
Sourcepub fn filled(sz: Vec3<u32>, vox: V, meta: M) -> Self
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.
Sourcepub fn from_fn<F: FnMut(Vec3<i32>) -> V>(sz: Vec3<u32>, meta: M, f: F) -> Self
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
.
Sourcepub fn metadata_mut(&mut self) -> &mut M
pub fn metadata_mut(&mut self) -> &mut M
Get a mutable reference to the internal metadata.
Trait Implementations§
Source§impl<'de, V, M, A: Access> Deserialize<'de> for Dyna<V, M, A>where
V: Deserialize<'de>,
M: Deserialize<'de>,
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>,
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>
impl<V, M, A: Access> ReadVol for Dyna<V, M, A>
Source§fn get(&self, pos: Vec3<i32>) -> Result<&V, DynaError>
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
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.