pub struct ChunkLightLayerStorage {
layer: LightLayer,
range: LightSectionRange,
chunk_section_count: usize,
sections: Box<[LightSection]>,
emptiness_map: Option<Box<[bool]>>,
}Expand description
Per-layer chunk-owned light storage.
Fields§
§layer: LightLayer§range: LightSectionRange§chunk_section_count: usize§sections: Box<[LightSection]>§emptiness_map: Option<Box<[bool]>>Implementations§
Source§impl ChunkLightLayerStorage
impl ChunkLightLayerStorage
Sourcepub fn new(
layer: LightLayer,
range: LightSectionRange,
chunk_section_count: usize,
) -> Self
pub fn new( layer: LightLayer, range: LightSectionRange, chunk_section_count: usize, ) -> Self
Creates missing light sections for every light section in a chunk.
Sourcepub const fn layer(&self) -> LightLayer
pub const fn layer(&self) -> LightLayer
Returns this storage’s light layer.
Sourcepub const fn range(&self) -> LightSectionRange
pub const fn range(&self) -> LightSectionRange
Returns the vertical light-section range.
Sourcepub fn sections(&self) -> &[LightSection]
pub fn sections(&self) -> &[LightSection]
Returns all chunk light sections.
Sourcepub fn sections_mut(&mut self) -> &mut [LightSection]
pub fn sections_mut(&mut self) -> &mut [LightSection]
Returns all chunk light sections mutably.
Sourcepub const fn chunk_section_count(&self) -> usize
pub const fn chunk_section_count(&self) -> usize
Returns the number of real chunk sections tracked by the emptiness map.
Sourcepub fn section(&self, section_y: i32) -> Option<&LightSection>
pub fn section(&self, section_y: i32) -> Option<&LightSection>
Returns a light section for a section Y coordinate.
Sourcepub fn section_mut(&mut self, section_y: i32) -> Option<&mut LightSection>
pub fn section_mut(&mut self, section_y: i32) -> Option<&mut LightSection>
Returns a mutable light section for a section Y coordinate.
Sourcepub fn emptiness_map(&self) -> Option<&[bool]>
pub fn emptiness_map(&self) -> Option<&[bool]>
Returns the current section emptiness map, if known.
Sourcepub fn section_empty(&self, section_y: i32) -> Option<bool>
pub fn section_empty(&self, section_y: i32) -> Option<bool>
Returns the known emptiness for one real chunk section Y.
Sourcepub(crate) fn highest_non_empty_section_y(&self) -> Option<i32>
pub(crate) fn highest_non_empty_section_y(&self) -> Option<i32>
Returns the highest real chunk section known to contain blocks.
Sourcepub fn set_emptiness_map(
&mut self,
emptiness_map: Box<[bool]>,
) -> Result<(), ChunkLightEmptinessMapLengthError>
pub fn set_emptiness_map( &mut self, emptiness_map: Box<[bool]>, ) -> Result<(), ChunkLightEmptinessMapLengthError>
Replaces the section emptiness map.
Sourcepub fn refresh_emptiness_map_from_sections(
&mut self,
sections: &Sections,
) -> Result<(), ChunkLightEmptinessMapLengthError>
pub fn refresh_emptiness_map_from_sections( &mut self, sections: &Sections, ) -> Result<(), ChunkLightEmptinessMapLengthError>
Replaces the section emptiness map from current section counters.
Sourcepub fn set_section_empty(&mut self, section_y: i32, empty: bool) -> Option<bool>
pub fn set_section_empty(&mut self, section_y: i32, empty: bool) -> Option<bool>
Updates one known section emptiness entry, returning the previous value.
Sourcepub(crate) fn fill_loaded_missing_sky_sections_below_data_with_zero(&mut self)
pub(crate) fn fill_loaded_missing_sky_sections_below_data_with_zero(&mut self)
Applies ScalableLux’s loaded-sky-data normalization.
Sourcepub fn get_light_value(&self, block_pos: BlockPos) -> u8
pub fn get_light_value(&self, block_pos: BlockPos) -> u8
Returns the visible light value for one block position.
fn get_block_light_value(&self, block_pos: BlockPos) -> u8
fn get_sky_light_value(&self, block_pos: BlockPos) -> u8
fn visible_section_value(&self, block_pos: BlockPos) -> Option<u8>
fn chunk_section_index(&self, section_y: i32) -> Option<usize>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChunkLightLayerStorage
impl RefUnwindSafe for ChunkLightLayerStorage
impl Send for ChunkLightLayerStorage
impl Sync for ChunkLightLayerStorage
impl Unpin for ChunkLightLayerStorage
impl UnsafeUnpin for ChunkLightLayerStorage
impl UnwindSafe for ChunkLightLayerStorage
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<>>