Skip to main content

BlockLightPropagationContext

Struct BlockLightPropagationContext 

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

Implementations§

Source§

impl<'a, 'sections, 'light> BlockLightPropagationContext<'a, 'sections, 'light>

Source

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.

Source

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.

Source

pub fn seed_block_light_sources( &mut self, positions: impl IntoIterator<Item = BlockPos>, )

Seeds block-light sources in ScalableLux local-index order.

Source

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

Pulls horizontal neighbor levels into this chunk’s increase queue.

Source

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.

Source

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.

Source

pub fn perform_light_decrease(&mut self)

Performs queued ScalableLux block-light decreases, then re-propagates increases.

Source

pub fn perform_light_increase(&mut self)

Performs queued ScalableLux block-light increases.

Source

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

Source

fn enqueue_decrease( &mut self, block_pos: BlockPos, level: u8, directions: LightDirectionSet, flags: LightQueueFlags, )

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

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

Source

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

Source

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

fn enqueue_increase( &mut self, block_pos: BlockPos, level: u8, directions: LightDirectionSet, flags: LightQueueFlags, )

Source

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

Source

fn shape_flags(block_state: BlockStateId) -> LightQueueFlags

Source

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

Source

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