Struct veloren_common::volumes::dyna::Dyna
source · pub struct Dyna<V, M, A: Access = ColumnAccess> {
vox: Vec<V>,
meta: M,
pub sz: Vec3<u32>,
_phantom: PhantomData<A>,
}
Expand description
A volume with dimensions known only at the creation of the object.
Fields§
§vox: Vec<V>
§meta: M
§sz: Vec3<u32>
§_phantom: PhantomData<A>
Implementations§
source§impl Dyna<Cell, ()>
impl Dyna<Cell, ()>
sourcepub fn from_voxes(data: &[(&DotVoxData, Vec3<i32>, bool)]) -> (Self, Vec3<i32>)
pub fn from_voxes(data: &[(&DotVoxData, Vec3<i32>, bool)]) -> (Self, Vec3<i32>)
Take a list of voxel data, offsets, and x-mirror flags, and assembled them into a combined segment
pub fn from_vox_model_index( dot_vox_data: &DotVoxData, model_index: usize, ) -> Self
pub fn from_vox( dot_vox_data: &DotVoxData, flipped: bool, model_index: usize, ) -> Self
source§impl Dyna<MatCell, ()>
impl Dyna<MatCell, ()>
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<'a, V, M, A: Access> IntoPosIterator for &'a Dyna<V, M, A>
impl<'a, V, M, A: Access> IntoPosIterator for &'a Dyna<V, M, A>
source§impl<'a, V, M, A: Access> IntoVolIterator<'a> for &'a Dyna<V, M, A>
impl<'a, V, M, A: Access> IntoVolIterator<'a> for &'a Dyna<V, M, A>
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.
Auto Trait Implementations§
impl<V, M, A> Freeze for Dyna<V, M, A>where
M: Freeze,
impl<V, M, A> RefUnwindSafe for Dyna<V, M, A>
impl<V, M, A> Send for Dyna<V, M, A>
impl<V, M, A> Sync for Dyna<V, M, A>
impl<V, M, A> Unpin for Dyna<V, M, A>
impl<V, M, A> UnwindSafe for Dyna<V, M, A>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<C, M> ConvertSaveload<M> for C
impl<C, M> ConvertSaveload<M> for C
§type Error = Infallible
type Error = Infallible
Error may occur during serialization or deserialization of component
§fn convert_into<F>(
&self,
_: F,
) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
fn convert_into<F>( &self, _: F, ) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
Convert this data type into serializable form (
Data
) using
entity to marker mapping function§fn convert_from<F>(
data: <C as ConvertSaveload<M>>::Data,
_: F,
) -> Result<C, <C as ConvertSaveload<M>>::Error>
fn convert_from<F>( data: <C as ConvertSaveload<M>>::Data, _: F, ) -> Result<C, <C as ConvertSaveload<M>>::Error>
Convert this data from a deserializable form (
Data
) using
entity to marker mapping function§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more