/// Algorithm #2, as described in the module-level docs.
Algorithm #2, as described in the module-level docs.
Algorithm #2 as described in the module - level docs .
fn emitting_removal(
    context: &mut Context,
    chunk_lights: &ChunkLights,
    position: BlockPosition,
    old_block: Block,
) {
    // Perform flood fill and set all blocks affected by the old light to 0 light.
    flood_fill(context, position, old_block.light_emission(), |ctx, pos| {
        ctx.set_block_light_at(pos, 0);
    });
    // For all lights which could have affected the blocks we just set to 0,
    // recalculate lighting using algorithm #1.
    let nearby_lights = chunk_lights.lights_within_distance(position, MAX_TRAVEL_DISTANCE * 2);
    nearby_lights.into_iter().for_each(|light| {
        if light != position {
            emitting_creation(context, light);
        }
    });
}
fn emitting_removal ( context : & mut Context , chunk_lights : & ChunkLights , position : BlockPosition , old_block : Block , ) { // Perform flood fill and set all blocks affected by the old light to 0 light. flood_fill ( context , position , old_block . light_emission ( ) , | ctx , pos | { ctx . set_block_light_at ( pos , 0 ) ; } ) ; // For all lights which could have affected the blocks we just set to 0, // recalculate lighting using algorithm #1. let nearby_lights = chunk_lights . lights_within_distance ( position , MAX_TRAVEL_DISTANCE * 2 ) ; nearby_lights . into_iter ( ) . for_each ( | light | { if light != position { emitting_creation ( context , light ) ; } } ) ; }
Algorithm #2, as described in the module-level docs.
Algorithm #2 as described in the module - level docs .
context
&mut Context
chunk_lights
&ChunkLights
position
BlockPosition
old_block
Block