pub struct Space {
pub coords: Vec2<i32>,
pub width: usize,
pub shape: Vec3<usize>,
pub min: Vec3<i32>,
pub params: SpaceParams,
/* 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: usize
Width of the space.
shape: Vec3<usize>
Shape of the space.
min: Vec3<i32>
Minimum voxel coordinate of the space.
params: SpaceParams
Parameters to construct the space.
Implementations
sourceimpl Space
impl Space
sourcepub fn get_raw_voxel(&self, vx: i32, vy: i32, vz: i32) -> u32
pub 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.
sourcepub fn get_voxel(&self, vx: i32, vy: i32, vz: i32) -> u32
pub 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.
sourcepub fn get_voxel_rotation(&self, vx: i32, vy: i32, vz: i32) -> BlockRotation
pub 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.
sourcepub fn get_voxel_stage(&self, vx: i32, vy: i32, vz: i32) -> u32
pub 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.
sourcepub fn get_raw_light(&self, vx: i32, vy: i32, vz: i32) -> u32
pub 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.
sourcepub fn set_raw_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32)
pub fn set_raw_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32)
Set the raw light level at the voxel position. Does nothing if chunk doesn’t exist. Panics if space does not contain lighting data.
sourcepub fn get_sunlight(&self, vx: i32, vy: i32, vz: i32) -> u32
pub 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. Panics if space does not contain lighting data.
sourcepub fn set_sunlight(&mut self, vx: i32, vy: i32, vz: i32, level: u32)
pub fn set_sunlight(&mut self, vx: i32, vy: i32, vz: i32, level: u32)
Set the sunlight level at the voxel position. Does nothing if chunk doesn’t exist. Panics if space does not contain lighting data.
sourcepub fn get_red_light(&self, vx: i32, vy: i32, vz: i32) -> u32
pub fn get_red_light(&self, vx: i32, vy: i32, vz: i32) -> u32
Get the red light level at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain lighting data.
sourcepub fn set_red_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32)
pub fn set_red_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32)
Set the red light level at the voxel position. Does nothing if chunk doesn’t exist. Panics if space does not contain lighting data.
sourcepub fn get_green_light(&self, vx: i32, vy: i32, vz: i32) -> u32
pub fn get_green_light(&self, vx: i32, vy: i32, vz: i32) -> u32
Get the green light level at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain lighting data.
sourcepub fn set_green_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32)
pub fn set_green_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32)
Set the green light level at the voxel position. Does nothing if chunk doesn’t exist. Panics if space does not contain lighting data.
sourcepub fn get_blue_light(&self, vx: i32, vy: i32, vz: i32) -> u32
pub fn get_blue_light(&self, vx: i32, vy: i32, vz: i32) -> u32
Get the blue light level at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain lighting data.
sourcepub fn set_blue_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32)
pub fn set_blue_light(&mut self, vx: i32, vy: i32, vz: i32, level: u32)
Set the blue light level at the voxel position. Does nothing if chunk doesn’t exist. Panics if space does not contain lighting data.
sourcepub fn get_torch_light(
&self,
vx: i32,
vy: i32,
vz: i32,
color: &LightColor
) -> u32
pub fn get_torch_light(
&self,
vx: i32,
vy: i32,
vz: i32,
color: &LightColor
) -> u32
Get the torch light level of a color at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain lighting data.
sourcepub fn set_torch_light(
&mut self,
vx: i32,
vy: i32,
vz: i32,
level: u32,
color: &LightColor
)
pub fn set_torch_light(
&mut self,
vx: i32,
vy: i32,
vz: i32,
level: u32,
color: &LightColor
)
Set the torch light level of a color at the voxel position. Does nothing if chunk doesn’t exist. Panics if space does not contain lighting data.
sourcepub fn get_max_height(&self, vx: i32, vz: i32) -> u32
pub 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. Panics if height map data does not exist.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Space
impl Send for Space
impl Sync for Space
impl Unpin for Space
impl UnwindSafe for Space
Blanket Implementations
impl<T> Any for T where
T: Any,
impl<T> Any for T where
T: Any,
fn get_type_id(&self) -> TypeId
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> TryDefault for T where
T: Default,
impl<T> TryDefault for T where
T: Default,
sourcefn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
Tries to create the default.
sourcefn unwrap_default() -> Self
fn unwrap_default() -> Self
Calls try_default
and panics on an error case.