Struct veloren_common::volumes::vol_grid_2d::CachedVolGrid2d
source · pub struct CachedVolGrid2d<'a, V: RectRasterableVol> {
vol_grid_2d: &'a VolGrid2d<V>,
cache: Option<(Vec2<i32>, Arc<V>)>,
}
Fields§
§vol_grid_2d: &'a VolGrid2d<V>
§cache: Option<(Vec2<i32>, Arc<V>)>
Implementations§
source§impl<'a, V: RectRasterableVol> CachedVolGrid2d<'a, V>
impl<'a, V: RectRasterableVol> CachedVolGrid2d<'a, V>
source§impl<'a, V: RectRasterableVol + ReadVol> CachedVolGrid2d<'a, V>
impl<'a, V: RectRasterableVol + ReadVol> CachedVolGrid2d<'a, V>
Methods from Deref<Target = VolGrid2d<V>>§
sourcepub fn find_ground(&self, pos: Vec3<i32>) -> Vec3<i32>
pub fn find_ground(&self, pos: Vec3<i32>) -> Vec3<i32>
Find a location suitable for spawning an entity near the given position (but in the same chunk).
pub fn is_space(&self, pos: Vec3<i32>) -> bool
pub fn try_find_space(&self, pos: Vec3<i32>) -> Option<Vec3<i32>>
pub fn try_find_ground(&self, pos: Vec3<i32>) -> Option<Vec3<i32>>
pub fn get_interpolated<T, F>(&self, pos: Vec2<i32>, f: F) -> Option<T>
pub fn par_keys(&self) -> ParKeys<'_, Vec2<i32>, Arc<V>>
pub fn get_key(&self, key: Vec2<i32>) -> Option<&V>
pub fn get_key_real(&self, key: Vec2<i32>) -> Option<&V>
pub fn contains_key(&self, key: Vec2<i32>) -> bool
pub fn contains_key_real(&self, key: Vec2<i32>) -> bool
pub fn get_key_arc(&self, key: Vec2<i32>) -> Option<&Arc<V>>
pub fn get_key_arc_real(&self, key: Vec2<i32>) -> Option<&Arc<V>>
sourcepub fn key_pos(&self, key: Vec2<i32>) -> Vec2<i32>
pub fn key_pos(&self, key: Vec2<i32>) -> Vec2<i32>
Converts a chunk key (i.e. coordinates in terms of chunks) into a position in the world (aka “wpos”).
The returned position will be in the corner of the chunk.
sourcepub fn pos_key(&self, pos: Vec3<i32>) -> Vec2<i32>
pub fn pos_key(&self, pos: Vec3<i32>) -> Vec2<i32>
Converts a position in the world into a chunk key (i.e. coordinates in terms of chunks).
sourcepub fn pos_chunk(&self, pos: Vec3<i32>) -> Option<&V>
pub fn pos_chunk(&self, pos: Vec3<i32>) -> Option<&V>
Gets the chunk that contains the provided world position.
pub fn iter(&self) -> ChunkIter<'_, V> ⓘ
pub fn cached(&self) -> CachedVolGrid2d<'_, V>
Trait Implementations§
Auto Trait Implementations§
impl<'a, V> Freeze for CachedVolGrid2d<'a, V>
impl<'a, V> RefUnwindSafe for CachedVolGrid2d<'a, V>where
V: RefUnwindSafe,
impl<'a, V> Send for CachedVolGrid2d<'a, V>
impl<'a, V> Sync for CachedVolGrid2d<'a, V>
impl<'a, V> Unpin for CachedVolGrid2d<'a, V>
impl<'a, V> UnwindSafe for CachedVolGrid2d<'a, V>where
V: RefUnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
Converts
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>
Converts
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