pub struct ChunkChart<const CHUNK_SIZE: GridCoordinate> { /* private fields */ }Expand description
Precomputed information about the spherical pattern of chunks within view distance.
In order to use the same pattern for all possible view positions, the view position is rounded to enclosing chunk position.
Implementations§
Source§impl<const CHUNK_SIZE: GridCoordinate> ChunkChart<CHUNK_SIZE>
impl<const CHUNK_SIZE: GridCoordinate> ChunkChart<CHUNK_SIZE>
Sourcepub fn new(view_distance: FreeCoordinate) -> Self
pub fn new(view_distance: FreeCoordinate) -> Self
Constructs a new chart with the given view radius (in blocks).
This function may reuse the calculations from previous calls.
Sourcepub fn resize_if_needed(&mut self, view_distance: FreeCoordinate)
pub fn resize_if_needed(&mut self, view_distance: FreeCoordinate)
Recalculate the chart if the provided distance is different.
Sourcepub fn chunks(
&self,
origin: ChunkPos<CHUNK_SIZE>,
mask: OctantMask,
) -> impl DoubleEndedIterator<Item = ChunkPos<CHUNK_SIZE>> + FusedIterator + '_
pub fn chunks( &self, origin: ChunkPos<CHUNK_SIZE>, mask: OctantMask, ) -> impl DoubleEndedIterator<Item = ChunkPos<CHUNK_SIZE>> + FusedIterator + '_
Returns an iterator over the chunks in this chart — i.e. those intersecting a sphere (or more precisely, the Minkowski sum of a sphere and the chunk) around the given origin chunk.
The chunks are ordered from nearest to farthest in Euclidean distance; the iterator is a
DoubleEndedIterator so that Iterator::rev may be used to iterate from
farthest to nearest.
mask specifies which directions are in view, in terms of octants of direction vectors.
Chunks only visible in directions not in the mask will be culled.
Trait Implementations§
Source§impl<const CHUNK_SIZE: GridCoordinate> Clone for ChunkChart<CHUNK_SIZE>
impl<const CHUNK_SIZE: GridCoordinate> Clone for ChunkChart<CHUNK_SIZE>
Source§fn clone(&self) -> ChunkChart<CHUNK_SIZE>
fn clone(&self) -> ChunkChart<CHUNK_SIZE>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<const CHUNK_SIZE: GridCoordinate> Debug for ChunkChart<CHUNK_SIZE>
impl<const CHUNK_SIZE: GridCoordinate> Debug for ChunkChart<CHUNK_SIZE>
Source§impl<const CHUNK_SIZE: GridCoordinate> PartialEq for ChunkChart<CHUNK_SIZE>
impl<const CHUNK_SIZE: GridCoordinate> PartialEq for ChunkChart<CHUNK_SIZE>
impl<const CHUNK_SIZE: GridCoordinate> Eq for ChunkChart<CHUNK_SIZE>
impl<const CHUNK_SIZE: GridCoordinate> StructuralPartialEq for ChunkChart<CHUNK_SIZE>
Auto Trait Implementations§
impl<const CHUNK_SIZE: i32> Freeze for ChunkChart<CHUNK_SIZE>
impl<const CHUNK_SIZE: i32> RefUnwindSafe for ChunkChart<CHUNK_SIZE>
impl<const CHUNK_SIZE: i32> Send for ChunkChart<CHUNK_SIZE>
impl<const CHUNK_SIZE: i32> Sync for ChunkChart<CHUNK_SIZE>
impl<const CHUNK_SIZE: i32> Unpin for ChunkChart<CHUNK_SIZE>
impl<const CHUNK_SIZE: i32> UnwindSafe for ChunkChart<CHUNK_SIZE>
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: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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