Struct building_blocks_storage::chunk::map::ChunkMap [−][src]
pub struct ChunkMap<N, T, Bldr, Store> { pub indexer: ChunkIndexer<N>, // some fields omitted }
Expand description
A lattice map made up of same-shaped Array
chunks. For each level of detail, it takes a value at every possible PointN
,
because accesses made outside of the stored chunks will return some ambient value specified on creation.
ChunkMap
is generic over the type used to actually store the Chunk
s. You can use any storage that implements
ChunkReadStorage
or ChunkWriteStorage
. Being a lattice map, ChunkMapLodView
will implement various access traits,
depending on the capabilities of the chunk storage.
If the chunk storage implements ChunkReadStorage
, then ChunkMapLodView
will implement:
Get
ForEach
ReadExtent
If the chunk storage implements ChunkWriteStorage
, then ChunkMapLodView
will implement:
GetMut
ForEachMut
WriteExtent
Fields
indexer: ChunkIndexer<N>
Translates from lattice coordinates to chunk key space.
Implementations
impl<N, T, Bldr, Store> ChunkMap<N, T, Bldr, Store> where
PointN<N>: IntegerPoint<N>,
ChunkKey<N>: Copy,
T: Clone,
Bldr: ChunkMapBuilder<N, T>,
Bldr::Chunk: FillExtent<N, Item = T> + IndexedArray<N>,
Store: ChunkWriteStorage<N, Bldr::Chunk>,
[src]
impl<N, T, Bldr, Store> ChunkMap<N, T, Bldr, Store> where
PointN<N>: IntegerPoint<N>,
ChunkKey<N>: Copy,
T: Clone,
Bldr: ChunkMapBuilder<N, T>,
Bldr::Chunk: FillExtent<N, Item = T> + IndexedArray<N>,
Store: ChunkWriteStorage<N, Bldr::Chunk>,
[src]pub fn downsample_chunk<Samp>(
&mut self,
sampler: &Samp,
src_chunk_key: ChunkKey<N>,
dst_lod: u8
) where
Samp: ChunkDownsampler<N, T, Bldr::Chunk, Bldr::Chunk>,
[src]
pub fn downsample_chunk<Samp>(
&mut self,
sampler: &Samp,
src_chunk_key: ChunkKey<N>,
dst_lod: u8
) where
Samp: ChunkDownsampler<N, T, Bldr::Chunk, Bldr::Chunk>,
[src]Downsamples the chunk at src_chunk_key
into the specified destination level dst_lod
.
pub fn downsample_external_chunk<Samp, Src>(
&mut self,
sampler: &Samp,
src_chunk_key: ChunkKey<N>,
src_chunk: &Src,
dst_lod: u8
) where
Samp: ChunkDownsampler<N, T, Src, Bldr::Chunk>,
[src]
pub fn downsample_external_chunk<Samp, Src>(
&mut self,
sampler: &Samp,
src_chunk_key: ChunkKey<N>,
src_chunk: &Src,
dst_lod: u8
) where
Samp: ChunkDownsampler<N, T, Src, Bldr::Chunk>,
[src]Downsamples all of src_chunk
into the overlapping chunk at level dst_lod
.
Fill the destination samples with the ambient value.
pub fn downsample_chunks_with_index<Samp>(
&mut self,
num_lods: u8,
index: &OctreeChunkIndex,
sampler: &Samp,
extent: &Extent3i
) where
Samp: ChunkDownsampler<[i32; 3], T, Bldr::Chunk, Bldr::Chunk>,
[src]
pub fn downsample_chunks_with_index<Samp>(
&mut self,
num_lods: u8,
index: &OctreeChunkIndex,
sampler: &Samp,
extent: &Extent3i
) where
Samp: ChunkDownsampler<[i32; 3], T, Bldr::Chunk, Bldr::Chunk>,
[src]Downsamples all chunks that both:
- overlap
extent
- are present in
index
Destination chunks up to num_lods
will be considered.
pub fn downsample_chunks_with_lod0_and_index<Samp, Lod0Ch, Lod0ChBorrow>(
&mut self,
num_lods: u8,
get_lod0_chunk: impl Fn(Point3i) -> Option<Lod0Ch>,
index: &OctreeChunkIndex,
sampler: &Samp,
extent: &Extent3i
) where
Lod0Ch: Borrow<Lod0ChBorrow>,
Samp: ChunkDownsampler<[i32; 3], T, Bldr::Chunk, Bldr::Chunk> + ChunkDownsampler<[i32; 3], T, Lod0ChBorrow, Bldr::Chunk>,
[src]
pub fn downsample_chunks_with_lod0_and_index<Samp, Lod0Ch, Lod0ChBorrow>(
&mut self,
num_lods: u8,
get_lod0_chunk: impl Fn(Point3i) -> Option<Lod0Ch>,
index: &OctreeChunkIndex,
sampler: &Samp,
extent: &Extent3i
) where
Lod0Ch: Borrow<Lod0ChBorrow>,
Samp: ChunkDownsampler<[i32; 3], T, Bldr::Chunk, Bldr::Chunk> + ChunkDownsampler<[i32; 3], T, Lod0ChBorrow, Bldr::Chunk>,
[src]Same as downsample_chunks_with_index
, but allows passing in a closure that fetches LOD0 chunks. This is mostly a
workaround so we can downsample multichannel chunks from LOD0.
Consumes self
and returns the backing chunk storage.
Borrows the internal chunk storage.
Get an immutable view of a single level of detail lod
in order to use the access traits.
Get a mutable view of a single level of detail lod
in order to use the access traits.
impl<N, T, Bldr, Store> ChunkMap<N, T, Bldr, Store> where
PointN<N>: IntegerPoint<N>,
Bldr: ChunkMapBuilder<N, T>,
Store: ChunkReadStorage<N, Bldr::Chunk>,
[src]
impl<N, T, Bldr, Store> ChunkMap<N, T, Bldr, Store> where
PointN<N>: IntegerPoint<N>,
Bldr: ChunkMapBuilder<N, T>,
Store: ChunkReadStorage<N, Bldr::Chunk>,
[src]Borrow the chunk at key
.
In debug mode only, asserts that key
is valid.
Get the values at point p
in level of detail lod
.
Get a reference to the values at point p
in level of detail lod
.
Call visitor
on all chunks that overlap extent
. Vacant chunks will be represented by an AmbientExtent
.
impl<N, T, Bldr, Store> ChunkMap<N, T, Bldr, Store> where
PointN<N>: IntegerPoint<N>,
Bldr: ChunkMapBuilder<N, T>,
Store: ChunkWriteStorage<N, Bldr::Chunk>,
[src]
impl<N, T, Bldr, Store> ChunkMap<N, T, Bldr, Store> where
PointN<N>: IntegerPoint<N>,
Bldr: ChunkMapBuilder<N, T>,
Store: ChunkWriteStorage<N, Bldr::Chunk>,
[src]Overwrite the Chunk
at key
with chunk
. Drops the previous value.
In debug mode only, asserts that key
is valid and chunk
’s shape is valid.
Replace the Chunk
at key
with chunk
, returning the old value.
In debug mode only, asserts that key
is valid and chunk
’s shape is valid.
Mutably borrow the chunk at key
.
In debug mode only, asserts that key
is valid.
Mutably borrow the chunk at key
. If the chunk doesn’t exist, create_chunk
is called to insert one.
In debug mode only, asserts that key
is valid.
Mutably borrow the chunk at key
. If the chunk doesn’t exist, a new chunk is created with the ambient value.
In debug mode only, asserts that key
is valid.
Get a mutable reference to the values at point p
in level of detail lod
.
Call visitor
on all chunks that overlap extent
. Vacant chunks will be created first with ambient value.
Call visitor
on all occupied chunks that overlap extent
.
impl<N, T, Bldr, Store> ChunkMap<N, T, Bldr, Store> where
ChunkMapLodView<&'r mut Self>: FillExtent<N, Item = T>,
[src]
impl<N, T, Bldr, Store> ChunkMap<N, T, Bldr, Store> where
ChunkMapLodView<&'r mut Self>: FillExtent<N, Item = T>,
[src]Fill all of extent
with the same value
.
impl<'a, N, T, Bldr, Store> ChunkMap<N, T, Bldr, Store> where
PointN<N>: IntegerPoint<N>,
Store: IterChunkKeys<'a, N>,
[src]
impl<'a, N, T, Bldr, Store> ChunkMap<N, T, Bldr, Store> where
PointN<N>: IntegerPoint<N>,
Store: IterChunkKeys<'a, N>,
[src]The smallest extent that bounds all chunks in level of detail lod
.
impl<N, T, Bldr, Compr> ChunkMap<N, T, Bldr, CompressibleChunkStorage<N, Compr>> where
ChunkKey<N>: Clone + Eq + Hash,
PointN<N>: IntegerPoint<N>,
Bldr: ChunkMapBuilder<N, T> + Clone,
Compr: Compression<Data = Bldr::Chunk>,
[src]
impl<N, T, Bldr, Compr> ChunkMap<N, T, Bldr, CompressibleChunkStorage<N, Compr>> where
ChunkKey<N>: Clone + Eq + Hash,
PointN<N>: IntegerPoint<N>,
Bldr: ChunkMapBuilder<N, T> + Clone,
Compr: Compression<Data = Bldr::Chunk>,
[src]pub fn reader<'a>(
&'a self,
local_cache: &'a LocalChunkCache<N, Bldr::Chunk>
) -> CompressibleChunkMapReader<'a, N, T, Bldr, Compr>
[src]
pub fn reader<'a>(
&'a self,
local_cache: &'a LocalChunkCache<N, Bldr::Chunk>
) -> CompressibleChunkMapReader<'a, N, T, Bldr, Compr>
[src]Construct a reader for this map.
Auto Trait Implementations
impl<N, T, Bldr, Store> RefUnwindSafe for ChunkMap<N, T, Bldr, Store> where
Bldr: RefUnwindSafe,
N: RefUnwindSafe,
Store: RefUnwindSafe,
T: RefUnwindSafe,
impl<N, T, Bldr, Store> Send for ChunkMap<N, T, Bldr, Store> where
Bldr: Send,
N: Send,
Store: Send,
T: Send,
impl<N, T, Bldr, Store> Sync for ChunkMap<N, T, Bldr, Store> where
Bldr: Sync,
N: Sync,
Store: Sync,
T: Sync,
impl<N, T, Bldr, Store> Unpin for ChunkMap<N, T, Bldr, Store> where
Bldr: Unpin,
N: Unpin,
Store: Unpin,
T: Unpin,
impl<N, T, Bldr, Store> UnwindSafe for ChunkMap<N, T, Bldr, Store> where
Bldr: UnwindSafe,
N: UnwindSafe,
Store: UnwindSafe,
T: UnwindSafe,