Skip to main content

SkyLightPropagationContext

Struct SkyLightPropagationContext 

Source
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>

Source

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.

Source

pub fn handle_unlit_empty_section_changes(&mut self, chunk_pos: ChunkPos)

Initializes the sky sections required around non-empty center sections.

Source

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.

Source

fn initialize_chunk_sections(&mut self, chunk_pos: ChunkPos, unlit: bool)

Source

pub(super) fn deinit_and_lazy_init_empty_sections( &mut self, chunk_pos: ChunkPos, unlit: bool, )

Source

fn section_neighborhood_all_empty( &self, chunk_pos: ChunkPos, section_y: i32, ) -> bool

Source

fn section_neighborhood_all_empty_if_known( &self, chunk_pos: ChunkPos, section_y: i32, ) -> Option<bool>

Source

pub fn reset_center_chunk_sections(&mut self)

Resets the center chunk to ScalableLux’s fresh all-missing lighting state.

Source§

impl SkyLightPropagationContext<'_, '_, '_>

Source

pub fn light_chunk( &mut self, chunk_pos: ChunkPos, edge_checks: SkyLightChunkEdgeChecks, )

Runs sky chunk lighting with the selected ScalableLux edge-check mode.

Source

pub fn check_block(&mut self, block_pos: BlockPos) -> bool

Handles one sky-light opacity change, matching ScalableLux checkBlock.

Source

pub fn propagate_block_changes(&mut self, positions: &[BlockPos])

Handles sky-light source and opacity changes for blocks in the center chunk.

Source

pub fn calculate_light_value( &self, block_pos: BlockPos, expect: u8, ) -> Option<u8>

Calculates the sky-light value that should exist at block_pos.

Source

pub(super) fn init_light_section( &mut self, section_pos: SectionPos, extrude: bool, init_removed: bool, )

Source

pub(super) fn section_is_non_empty(&self, section_pos: SectionPos) -> bool

Source

pub(super) fn check_missing_section( &mut self, chunk_pos: ChunkPos, section_y: i32, extrude_initialized: bool, ) -> bool

Source

fn propagate_full_empty_section_edges( &mut self, chunk_pos: ChunkPos, section_y: i32, )

Source

fn propagate_sky_sources_from_top( &mut self, chunk_pos: ChunkPos, highest_section: i32, )

Source

fn try_propagate_skylight_delayed( &mut self, x: i32, y: i32, z: i32, extrude_initialized: bool, delayed_increases: &mut Vec<PackedLightQueueEntry>, ) -> i32

Source

fn try_propagate_skylight_inner( &mut self, x: i32, y: i32, z: i32, extrude_initialized: bool, delayed_increases: Option<&mut Vec<PackedLightQueueEntry>>, ) -> i32

Source

fn initialize_changed_sections( &mut self, chunk_pos: ChunkPos, positions: &[BlockPos], )

Source

fn remove_sky_sources_below( &mut self, x: i32, y: i32, z: i32, delayed_decreases: &mut Vec<PackedLightQueueEntry>, )

Source§

impl SkyLightPropagationContext<'_, '_, '_>

Source

pub(super) fn process_delayed_increases( &mut self, entries: &[PackedLightQueueEntry], )

Source

pub(super) fn process_delayed_decreases( &mut self, entries: &[PackedLightQueueEntry], )

Source

pub(super) fn get_light_level_extruded(&self, block_pos: BlockPos) -> u8

Source

pub(super) fn propagate_neighbor_levels( &mut self, chunk_pos: ChunkPos, from_section: i32, to_section: i32, )

Source

fn propagate_neighbor_level_section( &mut self, chunk_pos: ChunkPos, section_y: i32, direction: LightAxisDirection, )

Source

pub(super) fn check_chunk_edges( &mut self, chunk_pos: ChunkPos, from_section: i32, to_section: i32, )

Source

fn check_chunk_edge(&mut self, chunk_pos: ChunkPos, section_y: i32)

Source

fn check_chunk_edge_direction( &mut self, chunk_pos: ChunkPos, neighbor_chunk_pos: ChunkPos, section_y: i32, direction: LightAxisDirection, )

Source

pub(super) fn perform_light_increase(&mut self)

Source

pub(super) fn perform_light_decrease(&mut self)

Source

fn target_level( propagated_level: u8, source_state: Option<BlockStateId>, target_state: BlockStateId, direction: Direction, ) -> Option<(u8, LightQueueFlags)>

Source

fn target_level_saturating( propagated_level: u8, source_state: Option<BlockStateId>, target_state: BlockStateId, direction: Direction, ) -> Option<(u8, LightQueueFlags)>

Source

fn cached_block_from_entry( &self, entry: PackedLightQueueEntry, ) -> Option<CachedLightBlock>

Source

pub(super) fn enqueue_decrease( &mut self, block_pos: BlockPos, level: u8, directions: LightDirectionSet, flags: LightQueueFlags, ) -> Option<PackedLightQueueEntry>

Source

pub(super) fn enqueue_increase( &mut self, block_pos: BlockPos, level: u8, directions: LightDirectionSet, flags: LightQueueFlags, ) -> Option<PackedLightQueueEntry>

Source

pub(super) fn block_state(&self, block_pos: BlockPos) -> BlockStateId

Source

pub(super) const fn current_edge_scan( chunk_pos: ChunkPos, direction: LightAxisDirection, ) -> (i32, i32, i32, i32)

Source

const fn neighbor_edge_scan( chunk_pos: ChunkPos, direction: LightAxisDirection, ) -> (i32, i32, i32, i32)

Source

const fn block_pos_from_local_index( chunk_offset_x: i32, chunk_offset_y: i32, chunk_offset_z: i32, local_index: usize, ) -> BlockPos

Source

pub(super) fn shape_flags(block_state: BlockStateId) -> LightQueueFlags

Source

pub(super) const fn offset( block_pos: BlockPos, direction: LightAxisDirection, ) -> BlockPos

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> IntoShared for T

Source§

fn into_shared(self) -> Arc<Mutex<RawMutex, Self>>

Wraps this value in an Arc<SyncMutex<>>
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more