Trait block_mesh::MergeStrategy
source · [−]pub trait MergeStrategy {
type Voxel;
unsafe fn find_quad(
min_index: u32,
max_width: u32,
max_height: u32,
face_strides: &FaceStrides,
voxels: &[Self::Voxel],
visited: &[bool]
) -> (u32, u32)
where
Self::Voxel: Voxel;
}
Expand description
A strategy for merging cube faces into quads.
Required Associated Types
Required Methods
Return the width and height of the quad that should be constructed.
min_index
: The linear index for the minimum voxel in this quad.
max_width
: The maximum possible width for the quad to be constructed.
max_height
: The maximum possible height for the quad to be constructed.
face_strides
: Strides to help with indexing in the necessary directions for this cube face.
voxels
: The entire array of voxel data.
visited
: The bitmask of which voxels have already been meshed. A quad’s extent will be marked as visited (true
)
after find_quad
returns.
Safety
Some implementations may use unchecked indexing of voxels
for performance. If this trait is not invoked with correct
arguments, access out of bounds may cause undefined behavior.