pub fn add_chunk(&mut self, chunk: Arc<Chunk>, light_chunk: Arc<LightChunk>) {
        // TODO: make sure this only happens once
        let chunk_pos = chunk.pos;
        self.chunks.insert(chunk_pos, ClientChunk {
            chunk,
            light_chunk,
            is_in_meshing_queue: false,
            needs_remesh: true,
        });
        // Queue adjacent chunks for meshing
        for i in -1..=1 {
            for j in -1..=1 {
                for k in -1..=1 {
                    let adjacent_chunk_pos = chunk_pos.offset(i, j, k);
                    if let Some(client_chunk) = self.chunks.get_mut(&adjacent_chunk_pos) {
                        client_chunk.needs_remesh = true;
                    }
                }
            }
        }
    }
/// Receive a new chunk from the server
Receive a new chunk from the server
Receive a new chunk from the server
pub fn add_chunk(&mut self, chunk: Arc<Chunk>, light_chunk: Arc<LightChunk>) {
        // TODO: make sure this only happens once
        let chunk_pos = chunk.pos;
        self.chunks.insert(chunk_pos, ClientChunk {
            chunk,
            light_chunk,
            is_in_meshing_queue: false,
            needs_remesh: true,
        });
        // Queue adjacent chunks for meshing
        for i in -1..=1 {
            for j in -1..=1 {
                for k in -1..=1 {
                    let adjacent_chunk_pos = chunk_pos.offset(i, j, k);
                    if let Some(client_chunk) = self.chunks.get_mut(&adjacent_chunk_pos) {
                        client_chunk.needs_remesh = true;
                    }
                }
            }
        }
    }
pub fn add_chunk ( & mut self , chunk : Arc < Chunk > , light_chunk : Arc < LightChunk > ) { // TODO: make sure this only happens once let chunk_pos = chunk . pos ; self . chunks . insert ( chunk_pos , ClientChunk { chunk , light_chunk , is_in_meshing_queue : false , needs_remesh : true , } ) ; // Queue adjacent chunks for meshing for i in - 1 ..= 1 { for j in - 1 ..= 1 { for k in - 1 ..= 1 { let adjacent_chunk_pos = chunk_pos . offset ( i , j , k ) ; if let Some ( client_chunk ) = self . chunks . get_mut ( & adjacent_chunk_pos ) { client_chunk . needs_remesh = true ; } } } } }
Receive a new chunk from the server
Receive a new chunk from the server
&mut self
chunk
Arc<Chunk>
light_chunk
Arc<LightChunk>
&mut self
chunk
Arc<Chunk>
light_chunk
Arc<LightChunk>