pub trait ReadVol: BaseVol {
    // Required method
    fn get(&self, pos: Vec3<i32>) -> Result<&Self::Vox, Self::Error>;

    // Provided methods
    fn get_unchecked(&self, pos: Vec3<i32>) -> &Self::Vox { ... }
    fn ray(
        &self,
        from: Vec3<f32>,
        to: Vec3<f32>
    ) -> Ray<'_, Self, fn(_: &Self::Vox) -> bool, fn(_: &Self::Vox, _: Vec3<i32>)>
       where Self: Sized { ... }
    fn for_each_in(&self, aabb: Aabb<i32>, f: impl FnMut(Vec3<i32>, Self::Vox))
       where Self::Vox: Copy { ... }
}
Expand description

A volume that provides read access to its voxel data.

Required Methods§

source

fn get(&self, pos: Vec3<i32>) -> Result<&Self::Vox, Self::Error>

Get a reference to the voxel at the provided position in the volume.

Provided Methods§

source

fn get_unchecked(&self, pos: Vec3<i32>) -> &Self::Vox

Get a reference to the voxel at the provided position in the volume. Many volumes provide a fast path, provided the position is always in-bounds. Note that this function is still safe.

source

fn ray( &self, from: Vec3<f32>, to: Vec3<f32> ) -> Ray<'_, Self, fn(_: &Self::Vox) -> bool, fn(_: &Self::Vox, _: Vec3<i32>)>
where Self: Sized,

NOTE: By default, this ray will simply run from from to to without stopping. To make something interesting happen, call until or for_each.

source

fn for_each_in(&self, aabb: Aabb<i32>, f: impl FnMut(Vec3<i32>, Self::Vox))
where Self::Vox: Copy,

Call provided closure with each block in the supplied Aabb Portions of the Aabb outside the volume are ignored

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'b, T: ReadVol> ReadVol for &'b T

source§

fn get(&self, pos: Vec3<i32>) -> Result<&Self::Vox, Self::Error>

Implementors§

source§

impl ReadVol for Structure

source§

impl<V, M, A: Access> ReadVol for Dyna<V, M, A>

source§

impl<V, S: RectVolSize, M: Clone> ReadVol for Chonk<V, S, M>

source§

impl<V, S: VolSize, M> ReadVol for Chunk<V, S, M>

source§

impl<V: RasterableVol + ReadVol + Debug> ReadVol for VolGrid3d<V>

source§

impl<V: ReadVol> ReadVol for Scaled<V>
where V::Vox: FilledVox,

source§

impl<V: RectRasterableVol + ReadVol + Debug> ReadVol for VolGrid2d<V>