pub struct SkyLightPropagationContext<'a, 'sections, 'light> {
pub(super) layout: LightCacheLayout,
pub(super) sections: &'a LightSectionReadCache<'sections>,
pub(super) light: &'a mut LightLayerEdit<'light>,
pub(super) queues: &'a mut PackedLightPropagationQueues,
pub(super) missing_section_checked: Vec<bool>,
}Expand description
ScalableLux-style sky-light propagation over scoped Steel light caches.
Fields§
§layout: LightCacheLayout§sections: &'a LightSectionReadCache<'sections>§light: &'a mut LightLayerEdit<'light>§queues: &'a mut PackedLightPropagationQueues§missing_section_checked: Vec<bool>Implementations§
Source§impl<'a, 'sections, 'light> SkyLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> SkyLightPropagationContext<'a, 'sections, 'light>
Sourcepub fn new(
sections: &'a LightSectionReadCache<'sections>,
light: &'a mut LightLayerEdit<'light>,
queues: &'a mut PackedLightPropagationQueues,
) -> Result<Self, SkyLightPropagationContextError>
pub fn new( sections: &'a LightSectionReadCache<'sections>, light: &'a mut LightLayerEdit<'light>, queues: &'a mut PackedLightPropagationQueues, ) -> Result<Self, SkyLightPropagationContextError>
Creates a sky-light propagation context from matching scoped caches.
Sourcepub fn handle_unlit_empty_section_changes(&mut self, chunk_pos: ChunkPos)
pub fn handle_unlit_empty_section_changes(&mut self, chunk_pos: ChunkPos)
Initializes the sky sections required around non-empty center sections.
Sourcepub fn handle_loaded_empty_section_changes(&mut self, chunk_pos: ChunkPos)
pub fn handle_loaded_empty_section_changes(&mut self, chunk_pos: ChunkPos)
Synchronizes sky sections for an already-lit loaded chunk without resetting light data.
fn initialize_chunk_sections(&mut self, chunk_pos: ChunkPos, unlit: bool)
pub(super) fn deinit_and_lazy_init_empty_sections( &mut self, chunk_pos: ChunkPos, unlit: bool, )
fn section_neighborhood_all_empty( &self, chunk_pos: ChunkPos, section_y: i32, ) -> bool
fn section_neighborhood_all_empty_if_known( &self, chunk_pos: ChunkPos, section_y: i32, ) -> Option<bool>
Sourcepub fn reset_center_chunk_sections(&mut self)
pub fn reset_center_chunk_sections(&mut self)
Resets the center chunk to ScalableLux’s fresh all-missing lighting state.
Source§impl SkyLightPropagationContext<'_, '_, '_>
impl SkyLightPropagationContext<'_, '_, '_>
Sourcepub fn light_chunk(
&mut self,
chunk_pos: ChunkPos,
edge_checks: SkyLightChunkEdgeChecks,
)
pub fn light_chunk( &mut self, chunk_pos: ChunkPos, edge_checks: SkyLightChunkEdgeChecks, )
Runs sky chunk lighting with the selected ScalableLux edge-check mode.
Sourcepub fn check_block(&mut self, block_pos: BlockPos) -> bool
pub fn check_block(&mut self, block_pos: BlockPos) -> bool
Handles one sky-light opacity change, matching ScalableLux checkBlock.
Sourcepub fn propagate_block_changes(&mut self, positions: &[BlockPos])
pub fn propagate_block_changes(&mut self, positions: &[BlockPos])
Handles sky-light source and opacity changes for blocks in the center chunk.
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 sky-light value that should exist at block_pos.
pub(super) fn init_light_section( &mut self, section_pos: SectionPos, extrude: bool, init_removed: bool, )
pub(super) fn section_is_non_empty(&self, section_pos: SectionPos) -> bool
pub(super) fn check_missing_section( &mut self, chunk_pos: ChunkPos, section_y: i32, extrude_initialized: bool, ) -> bool
fn propagate_full_empty_section_edges( &mut self, chunk_pos: ChunkPos, section_y: i32, )
fn propagate_sky_sources_from_top( &mut self, chunk_pos: ChunkPos, highest_section: i32, )
fn try_propagate_skylight_delayed( &mut self, x: i32, y: i32, z: i32, extrude_initialized: bool, delayed_increases: &mut Vec<PackedLightQueueEntry>, ) -> i32
fn try_propagate_skylight_inner( &mut self, x: i32, y: i32, z: i32, extrude_initialized: bool, delayed_increases: Option<&mut Vec<PackedLightQueueEntry>>, ) -> i32
fn initialize_changed_sections( &mut self, chunk_pos: ChunkPos, positions: &[BlockPos], )
fn remove_sky_sources_below( &mut self, x: i32, y: i32, z: i32, delayed_decreases: &mut Vec<PackedLightQueueEntry>, )
Source§impl SkyLightPropagationContext<'_, '_, '_>
impl SkyLightPropagationContext<'_, '_, '_>
pub(super) fn process_delayed_increases( &mut self, entries: &[PackedLightQueueEntry], )
pub(super) fn process_delayed_decreases( &mut self, entries: &[PackedLightQueueEntry], )
pub(super) fn get_light_level_extruded(&self, block_pos: BlockPos) -> u8
pub(super) fn propagate_neighbor_levels( &mut self, chunk_pos: ChunkPos, from_section: i32, to_section: i32, )
fn propagate_neighbor_level_section( &mut self, chunk_pos: ChunkPos, section_y: i32, direction: LightAxisDirection, )
pub(super) fn check_chunk_edges( &mut self, chunk_pos: ChunkPos, from_section: i32, to_section: i32, )
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, )
pub(super) fn perform_light_increase(&mut self)
pub(super) fn perform_light_decrease(&mut self)
fn target_level( propagated_level: u8, source_state: Option<BlockStateId>, target_state: BlockStateId, direction: Direction, ) -> Option<(u8, LightQueueFlags)>
fn target_level_saturating( propagated_level: u8, source_state: Option<BlockStateId>, target_state: BlockStateId, direction: Direction, ) -> Option<(u8, LightQueueFlags)>
fn cached_block_from_entry( &self, entry: PackedLightQueueEntry, ) -> Option<CachedLightBlock>
pub(super) fn enqueue_decrease( &mut self, block_pos: BlockPos, level: u8, directions: LightDirectionSet, flags: LightQueueFlags, ) -> Option<PackedLightQueueEntry>
pub(super) fn enqueue_increase( &mut self, block_pos: BlockPos, level: u8, directions: LightDirectionSet, flags: LightQueueFlags, ) -> Option<PackedLightQueueEntry>
pub(super) fn block_state(&self, block_pos: BlockPos) -> BlockStateId
pub(super) 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
pub(super) fn shape_flags(block_state: BlockStateId) -> LightQueueFlags
pub(super) const fn offset( block_pos: BlockPos, direction: LightAxisDirection, ) -> BlockPos
pub(super) fn air() -> BlockStateId
Auto Trait Implementations§
impl<'a, 'sections, 'light> !RefUnwindSafe for SkyLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> !Send for SkyLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> !UnwindSafe for SkyLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> Freeze for SkyLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> Sync for SkyLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> Unpin for SkyLightPropagationContext<'a, 'sections, 'light>
impl<'a, 'sections, 'light> UnsafeUnpin for SkyLightPropagationContext<'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
Mutably borrows from an owned value. Read more
§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> ⓘ
Converts
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> ⓘ
Converts
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 moreWraps this value in an
Arc<SyncMutex<>>