Struct Mesher

Source
pub struct Mesher {
    pub quads: [Vec<u64>; 6],
    /* private fields */
}

Fields§

§quads: [Vec<u64>; 6]

Implementations§

Source§

impl Mesher

Source

pub fn new() -> Self

Creates a mesher object, allocates necessary buffers

Source

pub fn clear(&mut self)

Call this between each meshing call to reset the buffers without reallocating them

Source

pub fn fast_mesh( &mut self, voxels: &[u16], opaque_mask: &[u64], trans_mask: &[u64], )

Meshes a voxel buffer representing a chunk, using an opaque and transparent mask with 1 u64 per column with 1 bit per voxel in the column, signaling if the voxel is opaque or transparent. This is ~4x faster than the regular mesh method but requires maintaining 2 masks for each chunk. See https://github.com/Inspirateur/binary-greedy-meshing?tab=readme-ov-file#what-to-do-with-mesh_dataquads for using the output

Source

pub fn mesh(&mut self, voxels: &[u16], transparents: &BTreeSet<u16>)

Meshes a voxel buffer representing a chunk, using a BTreeSet signaling which voxel values are transparent. This is ~4x slower than the fast_mesh method but does not require maintaining 2 masks for each chunk. See https://github.com/Inspirateur/binary-greedy-meshing?tab=readme-ov-file#what-to-do-with-mesh_dataquads for using the output

Trait Implementations§

Source§

impl Debug for Mesher

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Mesher

§

impl RefUnwindSafe for Mesher

§

impl Send for Mesher

§

impl Sync for Mesher

§

impl Unpin for Mesher

§

impl UnwindSafe for Mesher

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.