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

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.

Get the voxel type at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain voxel data.

Get the voxel rotation at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain voxel data.

Get the voxel stage at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain voxel data.

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.

Set the raw light level at the voxel position. Does nothing if chunk doesn’t exist. Panics if space does not contain lighting data.

Get the sunlight level at the voxel position. Zero is returned if chunk doesn’t exist. Panics if space does not contain lighting data.

Set the sunlight level at the voxel position. Does nothing if chunk doesn’t exist. Panics if space does not contain lighting data.

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.

Set the red light level at the voxel position. Does nothing if chunk doesn’t exist. Panics if space does not contain lighting data.

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.

Set the green light level at the voxel position. Does nothing if chunk doesn’t exist. Panics if space does not contain lighting data.

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.

Set the blue light level at the voxel position. Does nothing if chunk doesn’t exist. Panics if space does not contain lighting data.

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.

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.

Get the max height at the voxel column. Zero is returned if column doesn’t exist. Panics if height map data does not exist.

Get a reference of lighting n-dimensional array.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

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

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Tries to create the default.

Calls try_default and panics on an error case.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.