pub struct Batch<T: VoxelTrait> { /* private fields */ }
Expand description
Accumulates per-node voxel modifications, enabling efficient bulk updates for an octree.
§Type parameters
T
- The voxel type implementingVoxelTrait
.
Implementations§
Source§impl<T: VoxelTrait> Batch<T>
impl<T: VoxelTrait> Batch<T>
Sourcepub fn masks(&self) -> &Vec<(u8, u8)>
pub fn masks(&self) -> &Vec<(u8, u8)>
Returns the internal vector of (set_mask
, clear_mask
) pairs per node.
Sourcepub fn values(&self) -> &Vec<[T; 8]>
pub fn values(&self) -> &Vec<[T; 8]>
Returns the buffered voxel values array for each child of every node.
Sourcepub fn to_fill(&self) -> Option<T>
pub fn to_fill(&self) -> Option<T>
Returns the uniform fill value if fill
was invoked; otherwise None
.
Sourcepub fn has_patches(&self) -> bool
pub fn has_patches(&self) -> bool
Indicates whether any operations have been recorded in this batch.
Sourcepub fn just_set(&mut self, position: IVec3, voxel: T) -> bool
pub fn just_set(&mut self, position: IVec3, voxel: T) -> bool
Records a voxel set or clear operation at the specified 3D position.
Returns true
indicating that the state has changed.
§Arguments
position
- 3D coordinates of the voxel to modify.voxel
- The voxel value to set;T::default()
clears the voxel.
§Panics
Panics if position
is out of bounds for the configured max_depth
.
Trait Implementations§
Source§impl<T: VoxelTrait> VoxOpsWrite<T> for Batch<T>
impl<T: VoxelTrait> VoxOpsWrite<T> for Batch<T>
Source§fn set(
&mut self,
_interner: &mut VoxInterner<T>,
position: IVec3,
voxel: T,
) -> bool
fn set( &mut self, _interner: &mut VoxInterner<T>, position: IVec3, voxel: T, ) -> bool
Records a set or clear operation for the given position
, delegating to just_set
.
Records a voxel set or clear operation at the specified 3D position.
Returns true
indicating that the state has changed.
§Arguments
position
- 3D coordinates of the voxel to modify.voxel
- The voxel value to set;T::default()
clears the voxel.
§Panics
Panics if position
is out of bounds for the configured max_depth
.
Source§fn fill(&mut self, interner: &mut VoxInterner<T>, value: T)
fn fill(&mut self, interner: &mut VoxInterner<T>, value: T)
Clears existing operations and sets a uniform fill value for the batch.
Source§fn clear(&mut self, _interner: &mut VoxInterner<T>)
fn clear(&mut self, _interner: &mut VoxInterner<T>)
Resets all recorded operations, clearing masks, values, and fill state.
Auto Trait Implementations§
impl<T> Freeze for Batch<T>where
T: Freeze,
impl<T> RefUnwindSafe for Batch<T>where
T: RefUnwindSafe,
impl<T> Send for Batch<T>where
T: Send,
impl<T> Sync for Batch<T>where
T: Sync,
impl<T> Unpin for Batch<T>where
T: Unpin,
impl<T> UnwindSafe for Batch<T>where
T: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more