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>

source

fn new(vol_grid_2d: &'a VolGrid2d<V>) -> Self

source§

impl<'a, V: RectRasterableVol + ReadVol> CachedVolGrid2d<'a, V>

source

pub fn get(&mut self, pos: Vec3<i32>) -> Result<&V::Vox, VolGrid2dError<V>>

Methods from Deref<Target = VolGrid2d<V>>§

source

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).

source

pub fn is_space(&self, pos: Vec3<i32>) -> bool

source

pub fn try_find_space(&self, pos: Vec3<i32>) -> Option<Vec3<i32>>

source

pub fn try_find_ground(&self, pos: Vec3<i32>) -> Option<Vec3<i32>>

source

pub fn get_interpolated<T, F>(&self, pos: Vec2<i32>, f: F) -> Option<T>
where T: Copy + Default + Add<Output = T> + Mul<f32, Output = T>, F: FnMut(&TerrainChunk) -> T,

source

pub fn par_keys(&self) -> ParKeys<'_, Vec2<i32>, Arc<V>>
where V: Send + Sync,

source

pub fn get_key(&self, key: Vec2<i32>) -> Option<&V>

source

pub fn get_key_real(&self, key: Vec2<i32>) -> Option<&V>

source

pub fn contains_key(&self, key: Vec2<i32>) -> bool

source

pub fn contains_key_real(&self, key: Vec2<i32>) -> bool

source

pub fn get_key_arc(&self, key: Vec2<i32>) -> Option<&Arc<V>>

source

pub fn get_key_arc_real(&self, key: Vec2<i32>) -> Option<&Arc<V>>

source

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.

source

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).

source

pub fn pos_chunk(&self, pos: Vec3<i32>) -> Option<&V>

Gets the chunk that contains the provided world position.

source

pub fn iter(&self) -> ChunkIter<'_, V>

source

pub fn cached(&self) -> CachedVolGrid2d<'_, V>

Trait Implementations§

source§

impl<'a, V: RectRasterableVol> Deref for CachedVolGrid2d<'a, V>

§

type Target = VolGrid2d<V>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.

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>
where V: Sync + Send,

§

impl<'a, V> Sync for CachedVolGrid2d<'a, V>
where V: Sync + Send,

§

impl<'a, V> Unpin for CachedVolGrid2d<'a, V>

§

impl<'a, V> UnwindSafe for CachedVolGrid2d<'a, V>
where V: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<Context> SubContext<Context> for Context

source§

fn sub_context(self) -> Context

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Event for T
where T: Send + Sync + 'static,

§

impl<T> Resource for T
where T: Any + Send + Sync,

§

impl<T> Storable for T
where T: Send + Sync + 'static,