pub struct ChunkCoord {
pub x: i32,
pub y: i32,
pub z: i32,
}Fields§
§x: i32§y: i32§z: i32Implementations§
Source§impl ChunkCoord
impl ChunkCoord
pub fn new(x: i32, y: i32, z: i32) -> Self
pub fn from_world_pos(pos: Vec3, chunk_size: f32) -> Self
pub fn to_world_min(&self, chunk_size: f32) -> Vec3
pub fn to_world_center(&self, chunk_size: f32) -> Vec3
pub fn manhattan_distance(&self, other: &ChunkCoord) -> i32
pub fn chebyshev_distance(&self, other: &ChunkCoord) -> i32
pub fn euclidean_distance_sq(&self, other: &ChunkCoord) -> i64
pub fn neighbors_6(&self) -> [ChunkCoord; 6]
pub fn neighbors_26(&self) -> Vec<ChunkCoord>
pub fn chunks_in_radius(center: &ChunkCoord, radius: i32) -> Vec<ChunkCoord>
pub fn is_adjacent(&self, other: &ChunkCoord) -> bool
pub fn offset(&self, dx: i32, dy: i32, dz: i32) -> ChunkCoord
pub fn pack_u64(&self) -> u64
pub fn unpack_u64(packed: u64) -> ChunkCoord
Trait Implementations§
Source§impl Clone for ChunkCoord
impl Clone for ChunkCoord
impl Copy for ChunkCoord
Source§impl Debug for ChunkCoord
impl Debug for ChunkCoord
Source§impl Display for ChunkCoord
impl Display for ChunkCoord
impl Eq for ChunkCoord
Source§impl Hash for ChunkCoord
impl Hash for ChunkCoord
Source§impl Ord for ChunkCoord
impl Ord for ChunkCoord
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ChunkCoord
impl PartialEq for ChunkCoord
Source§impl PartialOrd for ChunkCoord
impl PartialOrd for ChunkCoord
impl StructuralPartialEq for ChunkCoord
Auto Trait Implementations§
impl Freeze for ChunkCoord
impl RefUnwindSafe for ChunkCoord
impl Send for ChunkCoord
impl Sync for ChunkCoord
impl Unpin for ChunkCoord
impl UnsafeUnpin for ChunkCoord
impl UnwindSafe for ChunkCoord
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Compare self to
key and return true if they are equal.