pub struct Chunks {
    pub map: HashMap<Vec2<i32>, Chunk>,
    pub to_update: VecDeque<BlockChange>,
    pub to_remesh: VecDeque<Vec2<i32>>,
    pub to_send: VecDeque<(Vec2<i32>, MessageType)>,
    pub to_save: VecDeque<Vec2<i32>>,
    pub cache: HashSet<Vec2<i32>>,
    /* private fields */
}
Expand description

A manager for all chunks in the Voxelize world.

Fields

map: HashMap<Vec2<i32>, Chunk>

A map of all the chunks, coords -> Chunk.

to_update: VecDeque<BlockChange>

Voxel updates waiting to be processed.

to_remesh: VecDeque<Vec2<i32>>

A list of chunks that are to be remeshed (light + mesh).

to_send: VecDeque<(Vec2<i32>, MessageType)>

A list of chunks that are done meshing and ready to be sent.

to_save: VecDeque<Vec2<i32>>

A list of chunks that are done meshing and ready to be saved, if config.save is true.

cache: HashSet<Vec2<i32>>

A cache of what chunks has been borrowed mutable.

Implementations

Create a new instance of a chunk manager.

Update a chunk, removing the old chunk instance and updating with a new one.

Add a new chunk, synonym for chunks.renew

Get raw chunk data.

Get raw mutable chunk data.

Get a chunk at a chunk coordinate. Keep in mind that this function only returns a chunk if the chunk has been fully instantiated and meshed. None is returned if not.

Get a mutable chunk reference at a chunk coordinate. Keep in mind that this function only returns a chunk if the chunk has been fully instantiated and meshed. None is returned if not.

Get a mutable chunk by voxel coordinates. Returns a chunk even if chunk isn’t fully instantiated.

Get neighboring coords of a voxel coordinate.

Get a list of chunks that light could traverse within.

Create a voxel querying space around a chunk coordinate.

Example
// Create a space that has all voxel/light/height_map data.
let space = Chunks::make_space(0, 0, 15).needs_all().build();

Check to see if chunk is within the world’s min/max chunk.

Guard to getting a chunk, only allowing chunks to be accessed when they’re ready.

Clear the mutable chunk borrowing list.

Trait Implementations

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

Get the raw voxel value at a voxel coordinate. If chunk not found, 0 is returned.

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

Get the raw light value at a voxel coordinate. If chunk not found, 0 is returned.

Set the raw light level at a voxel coordinate. Returns false couldn’t set.

Get the sunlight level at a voxel position. Returns 0 if chunk does not exist.

Get the max height at a voxel column. Returns 0 if column does not exist.

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

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

Get the voxel ID at a voxel coordinate. If chunk not found, 0 is returned.

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

Get the voxel rotation at a voxel coordinate. Panics if chunk isn’t found.

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

Get the voxel stage at a voxel coordinate. Panics 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.

Get a reference of voxel n-dimensional array.

Get a reference of lighting n-dimensional array.

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.

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