pub struct GridLocalPos {
pub chunk: IVec3,
pub voxel: UVec3,
pub fract: Vec3,
}Expand description
Decomposition of a grid-local position into discrete chunk + voxel + sub-voxel coordinates.
chunk + voxel reconstructs the integer voxel coordinate via
voxel_global; adding fract (range [0, 1) per axis) and
the rotated origin gets back to the original world position
via grid_local_to_world. fract is f32 because per-chunk
ray math is f32 throughout — keeping the boundary cast here
means downstream code doesn’t repeat it.
Fields§
§chunk: IVec3Chunk index in grid-local space. Signed because chunks can extend in either direction from the grid origin.
voxel: UVec3Voxel offset within chunk. voxel.x, voxel.y are in
[0, CHUNK_SIZE_XY); voxel.z is in [0, CHUNK_SIZE_Z).
fract: Vec3Sub-voxel position within the voxel cell, [0, 1) per
axis. Cast to f32 because per-chunk ray math is f32.
Trait Implementations§
Source§impl Clone for GridLocalPos
impl Clone for GridLocalPos
Source§fn clone(&self) -> GridLocalPos
fn clone(&self) -> GridLocalPos
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GridLocalPos
impl Debug for GridLocalPos
Source§impl PartialEq for GridLocalPos
impl PartialEq for GridLocalPos
Source§fn eq(&self, other: &GridLocalPos) -> bool
fn eq(&self, other: &GridLocalPos) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for GridLocalPos
impl StructuralPartialEq for GridLocalPos
Auto Trait Implementations§
impl Freeze for GridLocalPos
impl RefUnwindSafe for GridLocalPos
impl Send for GridLocalPos
impl Sync for GridLocalPos
impl Unpin for GridLocalPos
impl UnsafeUnpin for GridLocalPos
impl UnwindSafe for GridLocalPos
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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