pub struct Space {
    pub coords: Vec2<i32>,
    pub width: usize,
    pub shape: Vec3<usize>,
    pub min: Vec3<i32>,
    pub params: SpaceParams,
    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: 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.

updated_levels: HashSet<u32>

A set of sub-chunks that have been updated.

Implementations

Check if space contains this coordinate

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

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. Returns false if chunk doesn’t exist.

Get the sunlight level at the voxel position. Zero is returned if chunk doesn’t exist.

Get the max height at the voxel column. Zero is returned if column doesn’t exist.

Get a reference of lighting n-dimensional array.

Set the raw voxel data at the voxel coordinate. Returns false couldn’t set.

Set the voxel type at a voxel coordinate. Returns false couldn’t set.

Set the voxel rotation at a voxel coordinate. Does nothing if chunk isn’t found.

Set the voxel stage at a voxel coordinate. Does nothing if chunk isn’t found.

Set the sunlight level at a voxel coordinate. Returns false if could not set.

Get the red light level at the voxel position. Zero is returned if chunk doesn’t exist.

Set the red light level at the voxel position. Returns false if could not set.

Get the green light level at the voxel position. Zero is returned if chunk doesn’t exist.

Set the green light level at the voxel position. Returns false if could not set.

Get the blue light level at the voxel position. Zero is returned if chunk doesn’t exist.

Set the blue light level at the voxel position. Returns false if could not set.

Get the torch light level by color at a voxel coordinate. Returns 0 if chunk does not exist.

Set the torch light level by color at a voxel coordinate. Returns false if could not set.

Set the max height at a voxel column. Does nothing if column does not exist.

Get a reference of voxel n-dimensional array.

Checks to see if the voxel is contained within the voxel acces.

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

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. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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 inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

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

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more