pub struct Sparse64Tree {
pub nodes: SlotMap<NodeKey, Node64>,
pub root: NodeKey,
}
Expand description
The sparse voxel tree using a slotmap to hold nodes.
Fields§
§nodes: SlotMap<NodeKey, Node64>
The nodes stored in a slotmap for stable keys.
root: NodeKey
The root node key.
Implementations§
Source§impl Sparse64Tree
impl Sparse64Tree
Sourcepub fn insert(&mut self, x: u32, y: u32, z: u32, depth: usize, color: [u8; 3])
pub fn insert(&mut self, x: u32, y: u32, z: u32, depth: usize, color: [u8; 3])
Inserts a voxel at the given (x, y, z) and depth with the provided color.
Sourcepub fn flatten(&self) -> Vec<u8> ⓘ
pub fn flatten(&self) -> Vec<u8> ⓘ
Flattens the slotmap-based tree into a contiguous byte vector for GPU upload. A breadth-first traversal assigns contiguous indices to nodes and computes each node’s child pointer (the index of its first child, if any).
Sourcepub fn generate_terrain_sdf_noise_simd(
&mut self,
aabb: AABB,
max_depth: usize,
noise: Perlin,
)
pub fn generate_terrain_sdf_noise_simd( &mut self, aabb: AABB, max_depth: usize, noise: Perlin, )
Generates terrain using the SIMD-accelerated noise-based SDF. A noise cache is used to avoid duplicate noise evaluations.
Auto Trait Implementations§
impl Freeze for Sparse64Tree
impl RefUnwindSafe for Sparse64Tree
impl Send for Sparse64Tree
impl Sync for Sparse64Tree
impl Unpin for Sparse64Tree
impl UnwindSafe for Sparse64Tree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more