pub struct BlockLightPropagationContext<'a, 'sections, 'light> {
layout: LightCacheLayout,
sections: &'a LightSectionReadCache<'sections>,
light: &'a mut LightLayerEdit<'light>,
queues: &'a mut PackedLightPropagationQueues,
}Expand description
ScalableLux-style block-light propagation over scoped Steel light caches.
This keeps the queue algorithm close to ScalableLux while avoiding long-lived
references into chunks: the caller owns the scoped section and light caches,
and this context only borrows them for one propagation pass.
Fields§
§layout: LightCacheLayout§sections: &'a LightSectionReadCache<'sections>§light: &'a mut LightLayerEdit<'light>§queues: &'a mut PackedLightPropagationQueuesImplementations§
Source§impl<'a, 'sections, 'light> BlockLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> BlockLightPropagationContext<'a, 'sections, 'light>
Sourcepub fn new(
sections: &'a LightSectionReadCache<'sections>,
light: &'a mut LightLayerEdit<'light>,
queues: &'a mut PackedLightPropagationQueues,
) -> Result<Self, BlockLightPropagationContextError>
pub fn new( sections: &'a LightSectionReadCache<'sections>, light: &'a mut LightLayerEdit<'light>, queues: &'a mut PackedLightPropagationQueues, ) -> Result<Self, BlockLightPropagationContextError>
Creates a block-light propagation context from matching scoped caches.
Sourcepub fn check_block(&mut self, block_pos: BlockPos) -> bool
pub fn check_block(&mut self, block_pos: BlockPos) -> bool
Handles one block-light source/opacity change, matching ScalableLux checkBlock.
Returns false when the changed block is outside this cache window.
Sourcepub fn seed_block_light_sources(
&mut self,
positions: impl IntoIterator<Item = BlockPos>,
)
pub fn seed_block_light_sources( &mut self, positions: impl IntoIterator<Item = BlockPos>, )
Seeds block-light sources in ScalableLux local-index order.
Sourcepub fn propagate_neighbor_levels(&mut self, chunk_pos: ChunkPos)
pub fn propagate_neighbor_levels(&mut self, chunk_pos: ChunkPos)
Pulls horizontal neighbor levels into this chunk’s increase queue.
Sourcepub fn check_chunk_edges(&mut self, chunk_pos: ChunkPos)
pub fn check_chunk_edges(&mut self, chunk_pos: ChunkPos)
Validates this chunk’s horizontal edges against cached neighbor edges.
This mirrors ScalableLux checkChunkEdges: edge values whose calculated
level differs from the stored value are delayed, converted into regular
block checks, then resolved through the decrease queue.
Sourcepub fn calculate_light_value(
&self,
block_pos: BlockPos,
expect: u8,
) -> Option<u8>
pub fn calculate_light_value( &self, block_pos: BlockPos, expect: u8, ) -> Option<u8>
Calculates the block-light value that should exist at block_pos.
Returns None when the position is outside this cache window.
Sourcepub fn perform_light_decrease(&mut self)
pub fn perform_light_decrease(&mut self)
Performs queued ScalableLux block-light decreases, then re-propagates increases.
Sourcepub fn perform_light_increase(&mut self)
pub fn perform_light_increase(&mut self)
Performs queued ScalableLux block-light increases.
fn cached_block_from_entry( &self, entry: PackedLightQueueEntry, ) -> Option<CachedLightBlock>
fn enqueue_decrease( &mut self, block_pos: BlockPos, level: u8, directions: LightDirectionSet, flags: LightQueueFlags, )
fn check_chunk_edge(&mut self, chunk_pos: ChunkPos, section_y: i32)
fn check_chunk_edge_direction( &mut self, chunk_pos: ChunkPos, neighbor_chunk_pos: ChunkPos, section_y: i32, direction: LightAxisDirection, )
fn seed_block_light_source(&mut self, block_pos: BlockPos) -> bool
fn propagate_neighbor_level_section( &mut self, chunk_pos: ChunkPos, section_y: i32, direction: LightAxisDirection, )
const fn current_edge_scan( chunk_pos: ChunkPos, direction: LightAxisDirection, ) -> (i32, i32, i32, i32)
const fn neighbor_edge_scan( chunk_pos: ChunkPos, direction: LightAxisDirection, ) -> (i32, i32, i32, i32)
const fn block_pos_from_local_index( chunk_offset_x: i32, chunk_offset_y: i32, chunk_offset_z: i32, local_index: usize, ) -> BlockPos
fn enqueue_increase( &mut self, block_pos: BlockPos, level: u8, directions: LightDirectionSet, flags: LightQueueFlags, )
fn target_level( propagated_level: u8, source_state: Option<BlockStateId>, target_state: BlockStateId, direction: Direction, saturating: bool, ) -> Option<(u8, LightQueueFlags)>
fn shape_flags(block_state: BlockStateId) -> LightQueueFlags
const fn offset(block_pos: BlockPos, direction: LightAxisDirection) -> BlockPos
fn air() -> BlockStateId
Auto Trait Implementations§
impl<'a, 'sections, 'light> !RefUnwindSafe for BlockLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> !Send for BlockLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> !UnwindSafe for BlockLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> Freeze for BlockLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> Sync for BlockLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> Unpin for BlockLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> UnsafeUnpin for BlockLightPropagationContext<'a, 'sections, 'light>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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 moreArc<SyncMutex<>>