pub struct Mesher<const CS: usize> {
pub quads: [Vec<Quad>; 6],
/* private fields */
}Fields§
§quads: [Vec<Quad>; 6]Implementations§
Source§impl<const CS: usize> Mesher<CS>
impl<const CS: usize> Mesher<CS>
pub const CS_2: usize
pub const CS_3: usize
pub const CS_P: usize
pub const CS_P2: usize
pub const CS_P3: usize
pub const P_MASK: u64
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Call this between each meshing call to reset the buffers without reallocating them
Sourcepub fn fast_mesh(
&mut self,
voxels: &[u16],
opaque_mask: &[u64],
trans_mask: &[u64],
)
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
Sourcepub fn mesh(&mut self, voxels: &[u16], transparents: &BTreeSet<u16>)
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
Sourcepub fn mesh_lod(
&mut self,
voxels: &mut [u16],
transparents: &BTreeSet<u16>,
lod: usize,
)
pub fn mesh_lod( &mut self, voxels: &mut [u16], transparents: &BTreeSet<u16>, lod: usize, )
Same as mesh but with a level-of-detail controlled by the lod parameter.
The LOD algorithm divides the chunk into cubic windows of size lod
and selects the first top voxel (assuming ZXY order, Y-up) encountered to fill that window.
If lod is 1 (or 0), this is equivalent to calling mesh.
NB: you don’t need to use multiples of the chunk size for lod. Partial windows are handled properly.