VoxBuffer

Trait VoxBuffer 

Source
pub trait VoxBuffer {
    // Required methods
    fn set_voxel(&mut self, voxel: Voxel);
    fn set_palette(&mut self, palette: Palette);

    // Provided methods
    fn set_version(&mut self, _version: Version) { ... }
    fn set_num_models(&mut self, _num_models: usize) { ... }
    fn set_model_size(&mut self, _model_size: Size) { ... }
}
Expand description

A trait for data structures that can constructed from a VOX file. [crate::vox::VoxData] implements this for convienience, but you can also implement this for your own voxel model types.

These are always called in this order:

  1. set_version
  2. set_palette
  3. set_num_models
  4. set_model_size
  5. set_voxel

set_model_size is always called before the voxels from this model are passed via set_voxel. set_model_size is called for each model, and set_voxel is called for each voxel in a model.

Required Methods§

Source

fn set_voxel(&mut self, voxel: Voxel)

Called for each voxel.

Source

fn set_palette(&mut self, palette: Palette)

Called when the color palette was read. This will be read before any calls to Self::set_voxel.

Provided Methods§

Source

fn set_version(&mut self, _version: Version)

Called after the file version was read.

The reader checks if the file version is supported, so most likely you can ignore this.

Source

fn set_num_models(&mut self, _num_models: usize)

Called after the number of models was detected.

Source

fn set_model_size(&mut self, _model_size: Size)

Called for each model before its voxels are being passed with VoxBuffer::set_voxel.

Implementors§