pub struct UniformPoint<P, const SIZE: u8, const SALT: u64> {
pub points: ArrayVec<P, 7>,
}
Expand description
A type of chunk that contains on average one point. You can specify a size in real world coordinates as well as a random number generator salt for picking different points even for the same chunk coordinates.
Fields§
§points: ArrayVec<P, 7>
The actual points. Can be up to 7, as a poisson distribution of one point per chunk has a negligible probability for more than 7 points.
Trait Implementations§
Source§impl<P: Reducible, const SIZE: u8, const SALT: u64> Chunk for UniformPoint<P, SIZE, SALT>
impl<P: Reducible, const SIZE: u8, const SALT: u64> Chunk for UniformPoint<P, SIZE, SALT>
Source§type LayerStore<T> = T
type LayerStore<T> = T
Data structure that stores the layer. Usually
Arc<Self>
,
but some layers are only used to simplify another layer, so
they can get stored directly without the Arc
indirection.Source§type Dependencies = ()
type Dependencies = ()
The actual dependencies. Usually a struct with fields of
Layer<T>
type, but
can be of any type to specify non-layer dependencies, too.
It is the type of the first argument of Chunk::compute.Source§fn compute((): &Self::Dependencies, index: GridPoint<Self>) -> Self
fn compute((): &Self::Dependencies, index: GridPoint<Self>) -> Self
Compute a chunk from its dependencies
Source§fn clear((): &Self::Dependencies, _index: GridPoint<Self>)
fn clear((): &Self::Dependencies, _index: GridPoint<Self>)
Clear all information that [compute] would have computed
Source§const GRID_SIZE: Point2d<u8> = _
const GRID_SIZE: Point2d<u8> = _
Exponent of
2
of the cached area (in grid chunk numbers, not world coordinates).
This is the area that should stay in memory at all times as it will get requested a lot.Source§const GRID_OVERLAP: u8 = 3u8
const GRID_OVERLAP: u8 = 3u8
Internal
RollingGrid
overlap before the system drops old chunks. Basically scales the grid width/height by
this number to allow moving across the grid width/height boundaries completely transparently.
Increasing this number makes indexing the RollingGrid
more expensive if there is a lot of overlap.Source§fn bounds_to_grid(bounds: Bounds) -> Bounds<GridIndex<Self>>
fn bounds_to_grid(bounds: Bounds) -> Bounds<GridIndex<Self>>
Get the grids that are touched by the given bounds.
Source§fn pos_to_grid(point: Point2d) -> GridPoint<Self>
fn pos_to_grid(point: Point2d) -> GridPoint<Self>
Get the grid the position is in
Source§fn vision_range(bounds: Bounds) -> Bounds
fn vision_range(bounds: Bounds) -> Bounds
Pad by a chunk size to make sure we see effects from the neighboring chunks
Source§impl<P: Clone, const SIZE: u8, const SALT: u64> Clone for UniformPoint<P, SIZE, SALT>
impl<P: Clone, const SIZE: u8, const SALT: u64> Clone for UniformPoint<P, SIZE, SALT>
Source§fn clone(&self) -> UniformPoint<P, SIZE, SALT>
fn clone(&self) -> UniformPoint<P, SIZE, SALT>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<P: Reducible, const SIZE: u8, const SALT: u64> Debug for UniformPoint<P, SIZE, SALT>
impl<P: Reducible, const SIZE: u8, const SALT: u64> Debug for UniformPoint<P, SIZE, SALT>
Source§fn debug(&self) -> Vec<DebugContent>
fn debug(&self) -> Vec<DebugContent>
Render the elements of this chunk type.
Source§impl<P: PartialEq, const SIZE: u8, const SALT: u64> PartialEq for UniformPoint<P, SIZE, SALT>
impl<P: PartialEq, const SIZE: u8, const SALT: u64> PartialEq for UniformPoint<P, SIZE, SALT>
impl<P, const SIZE: u8, const SALT: u64> StructuralPartialEq for UniformPoint<P, SIZE, SALT>
Auto Trait Implementations§
impl<P, const SIZE: u8, const SALT: u64> Freeze for UniformPoint<P, SIZE, SALT>where
P: Freeze,
impl<P, const SIZE: u8, const SALT: u64> RefUnwindSafe for UniformPoint<P, SIZE, SALT>where
P: RefUnwindSafe,
impl<P, const SIZE: u8, const SALT: u64> Send for UniformPoint<P, SIZE, SALT>where
P: Send,
impl<P, const SIZE: u8, const SALT: u64> Sync for UniformPoint<P, SIZE, SALT>where
P: Sync,
impl<P, const SIZE: u8, const SALT: u64> Unpin for UniformPoint<P, SIZE, SALT>where
P: Unpin,
impl<P, const SIZE: u8, const SALT: u64> UnwindSafe for UniformPoint<P, SIZE, SALT>where
P: UnwindSafe,
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