Struct VoxelShape
pub struct VoxelShape {
boxes: &'static [Aabb<DVec3, BlockLocal>],
}Expand description
A block-local voxel shape.
This currently stores the optimized AABB list extracted from vanilla data. It is intentionally a domain type rather than a raw slice so the full vanilla shape implementation can grow behind the same API.
Fields§
§boxes: &'static [Aabb<DVec3, BlockLocal>]Implementations§
§impl VoxelShape
impl VoxelShape
pub const EMPTY: VoxelShape
pub const EMPTY: VoxelShape
Empty shape.
pub const FULL_BLOCK: VoxelShape
pub const FULL_BLOCK: VoxelShape
Full block shape.
pub const fn from_boxes(boxes: &'static [Aabb<DVec3, BlockLocal>]) -> VoxelShape
pub const fn from_boxes(boxes: &'static [Aabb<DVec3, BlockLocal>]) -> VoxelShape
Creates a shape from static block-local boxes.
pub const fn boxes(self) -> &'static [Aabb<DVec3, BlockLocal>]
pub const fn boxes(self) -> &'static [Aabb<DVec3, BlockLocal>]
Returns the block-local boxes backing this shape.
pub fn iter(self) -> Iter<'static, Aabb<DVec3, BlockLocal>> ⓘ
pub fn iter(self) -> Iter<'static, Aabb<DVec3, BlockLocal>> ⓘ
Returns an iterator over the block-local boxes.
pub fn min(self, axis: Axis) -> f64
pub fn min(self, axis: Axis) -> f64
Returns the minimum coordinate on axis, or positive infinity for an empty shape.
pub fn max(self, axis: Axis) -> f64
pub fn max(self, axis: Axis) -> f64
Returns the maximum coordinate on axis, or negative infinity for an empty shape.
pub fn bounds(self) -> Option<Aabb<DVec3, BlockLocal>>
pub fn bounds(self) -> Option<Aabb<DVec3, BlockLocal>>
Returns the union bounds of this shape, or None for empty shapes.
pub fn has_large_collision_shape(self) -> bool
pub fn has_large_collision_shape(self) -> bool
Returns true when this shape extends outside its owning block.
Mirrors vanilla BlockState.hasLargeCollisionShape() for collision
iterator filtering.
Trait Implementations§
§impl Clone for VoxelShape
impl Clone for VoxelShape
§fn clone(&self) -> VoxelShape
fn clone(&self) -> VoxelShape
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for VoxelShape
§impl Debug for VoxelShape
impl Debug for VoxelShape
§impl IntoIterator for VoxelShape
impl IntoIterator for VoxelShape
§type IntoIter = Iter<'static, Aabb<DVec3, BlockLocal>>
type IntoIter = Iter<'static, Aabb<DVec3, BlockLocal>>
§type Item = &'static Aabb<DVec3, BlockLocal>
type Item = &'static Aabb<DVec3, BlockLocal>
§fn into_iter(self) -> <VoxelShape as IntoIterator>::IntoIter
fn into_iter(self) -> <VoxelShape as IntoIterator>::IntoIter
§impl PartialEq for VoxelShape
impl PartialEq for VoxelShape
impl StructuralPartialEq for VoxelShape
Auto Trait Implementations§
impl Freeze for VoxelShape
impl RefUnwindSafe for VoxelShape
impl Send for VoxelShape
impl Sync for VoxelShape
impl Unpin for VoxelShape
impl UnsafeUnpin for VoxelShape
impl UnwindSafe for VoxelShape
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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 moreArc<SyncMutex<>>