pub struct Space {
pub coords: Vec2<i32>,
pub width: usize,
pub shape: Vec3<usize>,
pub min: Vec3<i32>,
pub options: SpaceOptions,
pub updated_levels: HashSet<u32>,
/* private fields */
}Expand description
A data structure used in Voxelize to access voxel data of multiple chunks at the same time. Centered with one chunk, a Space allows developers to know what’s around a chunk.
Construct a space by calling chunks.make_space.
Fields§
§coords: Vec2<i32>Chunk coordinate of the center chunk of the space.
width: usizeWidth of the space.
shape: Vec3<usize>Shape of the space.
min: Vec3<i32>Minimum voxel coordinate of the space.
options: SpaceOptionsParameters to construct the space.
updated_levels: HashSet<u32>A set of sub-chunks that have been updated.
Trait Implementations§
Source§impl VoxelAccess for Space
impl VoxelAccess for Space
Source§fn get_raw_voxel(&self, vx: i32, vy: i32, vz: i32) -> u32
fn get_raw_voxel(&self, vx: i32, vy: i32, vz: i32) -> u32
Get the raw voxel data at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain voxel data.
Source§fn get_voxel(&self, vx: i32, vy: i32, vz: i32) -> u32
fn get_voxel(&self, vx: i32, vy: i32, vz: i32) -> u32
Get the voxel type at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain voxel data.
Source§fn get_voxel_rotation(&self, vx: i32, vy: i32, vz: i32) -> BlockRotation
fn get_voxel_rotation(&self, vx: i32, vy: i32, vz: i32) -> BlockRotation
Get the voxel rotation at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain voxel data.
Source§fn get_voxel_stage(&self, vx: i32, vy: i32, vz: i32) -> u32
fn get_voxel_stage(&self, vx: i32, vy: i32, vz: i32) -> u32
Get the voxel stage at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain voxel data.
Source§fn get_raw_light(&self, vx: i32, vy: i32, vz: i32) -> u32
fn get_raw_light(&self, vx: i32, vy: i32, vz: i32) -> u32
Get the raw light level at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain lighting data.
Source§fn set_raw_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32) -> bool
fn set_raw_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32) -> bool
Set the raw light level at the voxel position. Returns false if chunk doesn’t exist.
Source§fn get_sunlight(&self, vx: i32, vy: i32, vz: i32) -> u32
fn get_sunlight(&self, vx: i32, vy: i32, vz: i32) -> u32
Get the sunlight level at the voxel position. Zero is returned if chunk doesn’t exist.
Source§fn get_max_height(&self, vx: i32, vz: i32) -> u32
fn get_max_height(&self, vx: i32, vz: i32) -> u32
Get the max height at the voxel column. Zero is returned if column doesn’t exist.
Source§fn get_lights(&self, cx: i32, cz: i32) -> Option<&Ndarray<u32>>
fn get_lights(&self, cx: i32, cz: i32) -> Option<&Ndarray<u32>>
Get a reference of lighting n-dimensional array.
Source§fn set_raw_voxel(&mut self, vx: i32, vy: i32, vz: i32, voxel: u32) -> bool
fn set_raw_voxel(&mut self, vx: i32, vy: i32, vz: i32, voxel: u32) -> bool
Source§fn set_voxel(&mut self, vx: i32, vy: i32, vz: i32, id: u32) -> bool
fn set_voxel(&mut self, vx: i32, vy: i32, vz: i32, id: u32) -> bool
Source§fn set_voxel_rotation(
&mut self,
vx: i32,
vy: i32,
vz: i32,
rotation: &BlockRotation,
) -> bool
fn set_voxel_rotation( &mut self, vx: i32, vy: i32, vz: i32, rotation: &BlockRotation, ) -> bool
Source§fn set_voxel_stage(&mut self, vx: i32, vy: i32, vz: i32, stage: u32) -> bool
fn set_voxel_stage(&mut self, vx: i32, vy: i32, vz: i32, stage: u32) -> bool
Source§fn set_sunlight(&mut self, vx: i32, vy: i32, vz: i32, level: u32) -> bool
fn set_sunlight(&mut self, vx: i32, vy: i32, vz: i32, level: u32) -> bool
Source§fn get_red_light(&self, vx: i32, vy: i32, vz: i32) -> u32
fn get_red_light(&self, vx: i32, vy: i32, vz: i32) -> u32
Source§fn set_red_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32) -> bool
fn set_red_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32) -> bool
Source§fn get_green_light(&self, vx: i32, vy: i32, vz: i32) -> u32
fn get_green_light(&self, vx: i32, vy: i32, vz: i32) -> u32
Source§fn set_green_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32) -> bool
fn set_green_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32) -> bool
Source§fn get_blue_light(&self, vx: i32, vy: i32, vz: i32) -> u32
fn get_blue_light(&self, vx: i32, vy: i32, vz: i32) -> u32
Source§fn set_blue_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32) -> bool
fn set_blue_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32) -> bool
Source§fn get_torch_light(&self, vx: i32, vy: i32, vz: i32, color: &LightColor) -> u32
fn get_torch_light(&self, vx: i32, vy: i32, vz: i32, color: &LightColor) -> u32
Source§fn set_torch_light(
&mut self,
vx: i32,
vy: i32,
vz: i32,
level: u32,
color: &LightColor,
) -> bool
fn set_torch_light( &mut self, vx: i32, vy: i32, vz: i32, level: u32, color: &LightColor, ) -> bool
Auto Trait Implementations§
impl Freeze for Space
impl RefUnwindSafe for Space
impl Send for Space
impl Sync for Space
impl Unpin for Space
impl UnwindSafe for Space
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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)
&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)
&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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<T> TryDefault for Twhere
T: Default,
impl<T> TryDefault for Twhere
T: Default,
Source§fn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
Source§fn unwrap_default() -> Self
fn unwrap_default() -> Self
try_default and panics on an error case.