fn create_chunk_mesh_data(&self, pos: ChunkPos) -> ChunkMeshData {
        let client_chunk = self.chunks.get(&pos).expect("no chunk at current position to create ChunkMeshData");
        let mut all_chunks: [Option<Arc<Chunk>>; 27] = Default::default();
        let mut all_light_chunks: [Option<Arc<LightChunk>>; 27] = Default::default();
        for i in 0..3 {
            for j in 0..3 {
                for k in 0..3 {
                    let np = pos.offset(i - 1, j - 1, k - 1);
                    let idx = (i * 9 + j * 3 + k) as usize;
                    let adj_client_chunk = self.chunks.get(&np);
                    all_chunks[idx] = adj_client_chunk.map(|c| c.chunk.clone());
                    all_light_chunks[idx] = adj_client_chunk.map(|c| c.light_chunk.clone());
                }
            }
        }

        ChunkMeshData {
            chunk: client_chunk.chunk.clone(),
            light_chunk: client_chunk.light_chunk.clone(),
            all_chunks,
            all_light_chunks,
        }
    }
/// Create a `ChunkMeshData` for a loaded chunk
Create a `ChunkMeshData` for a loaded chunk
Create a ` ChunkMeshData ` for a loaded chunk
fn create_chunk_mesh_data(&self, pos: ChunkPos) -> ChunkMeshData {
        let client_chunk = self.chunks.get(&pos).expect("no chunk at current position to create ChunkMeshData");
        let mut all_chunks: [Option<Arc<Chunk>>; 27] = Default::default();
        let mut all_light_chunks: [Option<Arc<LightChunk>>; 27] = Default::default();
        for i in 0..3 {
            for j in 0..3 {
                for k in 0..3 {
                    let np = pos.offset(i - 1, j - 1, k - 1);
                    let idx = (i * 9 + j * 3 + k) as usize;
                    let adj_client_chunk = self.chunks.get(&np);
                    all_chunks[idx] = adj_client_chunk.map(|c| c.chunk.clone());
                    all_light_chunks[idx] = adj_client_chunk.map(|c| c.light_chunk.clone());
                }
            }
        }
        ChunkMeshData {
            chunk: client_chunk.chunk.clone(),
            light_chunk: client_chunk.light_chunk.clone(),
            all_chunks,
            all_light_chunks,
        }
    }
fn create_chunk_mesh_data ( & self , pos : ChunkPos ) -> ChunkMeshData { let client_chunk = self . chunks . get ( & pos ) . expect ( " " ) ; let mut all_chunks : [ Option < Arc < Chunk > > ; 27 ] = Default :: default ( ) ; let mut all_light_chunks : [ Option < Arc < LightChunk > > ; 27 ] = Default :: default ( ) ; for i in 0 .. 3 { for j in 0 .. 3 { for k in 0 .. 3 { let np = pos . offset ( i - 1 , j - 1 , k - 1 ) ; let idx = ( i * 9 + j * 3 + k ) as usize ; let adj_client_chunk = self . chunks . get ( & np ) ; all_chunks [ idx ] = adj_client_chunk . map ( | c | c . chunk . clone ( ) ) ; all_light_chunks [ idx ] = adj_client_chunk . map ( | c | c . light_chunk . clone ( ) ) ; } } } ChunkMeshData { chunk : client_chunk . chunk . clone ( ) , light_chunk : client_chunk . light_chunk . clone ( ) , all_chunks , all_light_chunks , } }
Create a `ChunkMeshData` for a loaded chunk
Create a ` ChunkMeshData ` for a loaded chunk
&self
pos
ChunkPos
&self
pos
ChunkPos