Enum all_is_cubes::block::Resolution
source · #[non_exhaustive]#[repr(u8)]pub enum Resolution {
R1 = 0,
R2 = 1,
R4 = 2,
R8 = 3,
R16 = 4,
R32 = 5,
R64 = 6,
R128 = 7,
}Expand description
Scale factor between a Block and its component voxels.
This resolution cubed is the number of voxels making up a block.
Resolutions are always powers of 2. This ensures that the arithmetic is well-behaved (no division by zero, exact floating-point representation, and the potential of fixed-point representation), and that it is always possible to subdivide a block further (up to the limit) without shifting the existing voxel boundaries.
Note that while quite high resolutions are permitted, this does not mean that it is practical to routinely use full blocks at that resolution. For example, 64 × 64 × 64 = 262,144 voxels, occupying several megabytes just for color data. High resolutions are permitted for special purposes that do not necessarily use the full cube volume:
- Thin blocks (e.g. 128 × 128 × 1) can display high resolution text and other 2D images.
- Multi-block structures can be defined using
Modifier::Zoom; their total size is limited by the resolution limit.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Implementations§
source§impl Resolution
impl Resolution
sourcepub const MAX: Resolution = Resolution::R128
pub const MAX: Resolution = Resolution::R128
The maximum available resolution.
sourcepub const fn double(self) -> Option<Resolution>
pub const fn double(self) -> Option<Resolution>
Returns the Resolution that’s twice this one, or None at the limit.
sourcepub const fn halve(self) -> Option<Resolution>
pub const fn halve(self) -> Option<Resolution>
Returns the Resolution that’s half this one, or None if self is
R1.
Trait Implementations§
source§impl<'arbitrary> Arbitrary<'arbitrary> for Resolution
impl<'arbitrary> Arbitrary<'arbitrary> for Resolution
source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Resolution, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Resolution, Error>
Self from the given unstructured data. Read moresource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Resolution, Error>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Resolution, Error>
Self from the entirety of the given
unstructured data. Read moresource§impl Clone for Resolution
impl Clone for Resolution
source§fn clone(&self) -> Resolution
fn clone(&self) -> Resolution
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for Resolution
impl Debug for Resolution
source§impl<'de> Deserialize<'de> for Resolution
impl<'de> Deserialize<'de> for Resolution
source§fn deserialize<D>(
deserializer: D,
) -> Result<Resolution, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Resolution, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl Display for Resolution
impl Display for Resolution
source§impl Div for Resolution
impl Div for Resolution
§type Output = Option<Resolution>
type Output = Option<Resolution>
/ operator.source§fn div(self, rhs: Resolution) -> <Resolution as Div>::Output
fn div(self, rhs: Resolution) -> <Resolution as Div>::Output
/ operation. Read moresource§impl Exhaust for Resolution
impl Exhaust for Resolution
§type Iter = ExhaustResolution
type Iter = ExhaustResolution
Self::exhaust(). Read moresource§impl Hash for Resolution
impl Hash for Resolution
source§impl Mul for Resolution
impl Mul for Resolution
§type Output = Option<Resolution>
type Output = Option<Resolution>
* operator.source§fn mul(self, rhs: Resolution) -> <Resolution as Mul>::Output
fn mul(self, rhs: Resolution) -> <Resolution as Mul>::Output
* operation. Read moresource§impl Ord for Resolution
impl Ord for Resolution
source§fn cmp(&self, other: &Resolution) -> Ordering
fn cmp(&self, other: &Resolution) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for Resolution
impl PartialEq for Resolution
source§fn eq(&self, other: &Resolution) -> bool
fn eq(&self, other: &Resolution) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd for Resolution
impl PartialOrd for Resolution
source§fn partial_cmp(&self, other: &Resolution) -> Option<Ordering>
fn partial_cmp(&self, other: &Resolution) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl Serialize for Resolution
impl Serialize for Resolution
source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
source§impl TryFrom<i128> for Resolution
impl TryFrom<i128> for Resolution
§type Error = IntoResolutionError<i128>
type Error = IntoResolutionError<i128>
source§fn try_from(
value: i128,
) -> Result<Resolution, <Resolution as TryFrom<i128>>::Error>
fn try_from( value: i128, ) -> Result<Resolution, <Resolution as TryFrom<i128>>::Error>
source§impl TryFrom<i16> for Resolution
impl TryFrom<i16> for Resolution
§type Error = IntoResolutionError<i16>
type Error = IntoResolutionError<i16>
source§fn try_from(
value: i16,
) -> Result<Resolution, <Resolution as TryFrom<i16>>::Error>
fn try_from( value: i16, ) -> Result<Resolution, <Resolution as TryFrom<i16>>::Error>
source§impl TryFrom<i32> for Resolution
impl TryFrom<i32> for Resolution
§type Error = IntoResolutionError<i32>
type Error = IntoResolutionError<i32>
source§fn try_from(
value: i32,
) -> Result<Resolution, <Resolution as TryFrom<i32>>::Error>
fn try_from( value: i32, ) -> Result<Resolution, <Resolution as TryFrom<i32>>::Error>
source§impl TryFrom<i64> for Resolution
impl TryFrom<i64> for Resolution
§type Error = IntoResolutionError<i64>
type Error = IntoResolutionError<i64>
source§fn try_from(
value: i64,
) -> Result<Resolution, <Resolution as TryFrom<i64>>::Error>
fn try_from( value: i64, ) -> Result<Resolution, <Resolution as TryFrom<i64>>::Error>
source§impl TryFrom<isize> for Resolution
impl TryFrom<isize> for Resolution
§type Error = IntoResolutionError<isize>
type Error = IntoResolutionError<isize>
source§fn try_from(
value: isize,
) -> Result<Resolution, <Resolution as TryFrom<isize>>::Error>
fn try_from( value: isize, ) -> Result<Resolution, <Resolution as TryFrom<isize>>::Error>
source§impl TryFrom<u128> for Resolution
impl TryFrom<u128> for Resolution
§type Error = IntoResolutionError<u128>
type Error = IntoResolutionError<u128>
source§fn try_from(
value: u128,
) -> Result<Resolution, <Resolution as TryFrom<u128>>::Error>
fn try_from( value: u128, ) -> Result<Resolution, <Resolution as TryFrom<u128>>::Error>
source§impl TryFrom<u16> for Resolution
impl TryFrom<u16> for Resolution
§type Error = IntoResolutionError<u16>
type Error = IntoResolutionError<u16>
source§fn try_from(
value: u16,
) -> Result<Resolution, <Resolution as TryFrom<u16>>::Error>
fn try_from( value: u16, ) -> Result<Resolution, <Resolution as TryFrom<u16>>::Error>
source§impl TryFrom<u32> for Resolution
impl TryFrom<u32> for Resolution
§type Error = IntoResolutionError<u32>
type Error = IntoResolutionError<u32>
source§fn try_from(
value: u32,
) -> Result<Resolution, <Resolution as TryFrom<u32>>::Error>
fn try_from( value: u32, ) -> Result<Resolution, <Resolution as TryFrom<u32>>::Error>
source§impl TryFrom<u64> for Resolution
impl TryFrom<u64> for Resolution
§type Error = IntoResolutionError<u64>
type Error = IntoResolutionError<u64>
source§fn try_from(
value: u64,
) -> Result<Resolution, <Resolution as TryFrom<u64>>::Error>
fn try_from( value: u64, ) -> Result<Resolution, <Resolution as TryFrom<u64>>::Error>
source§impl TryFrom<usize> for Resolution
impl TryFrom<usize> for Resolution
§type Error = IntoResolutionError<usize>
type Error = IntoResolutionError<usize>
source§fn try_from(
value: usize,
) -> Result<Resolution, <Resolution as TryFrom<usize>>::Error>
fn try_from( value: usize, ) -> Result<Resolution, <Resolution as TryFrom<usize>>::Error>
impl Copy for Resolution
impl Eq for Resolution
impl StructuralPartialEq for Resolution
Auto Trait Implementations§
impl Freeze for Resolution
impl RefUnwindSafe for Resolution
impl Send for Resolution
impl Sync for Resolution
impl Unpin for Resolution
impl UnwindSafe for Resolution
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)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)
clone_to_uninit)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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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>
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