diff --git a/src/game/world/chunk.rs b/src/game/world/chunk.rs index 6529df1..71bdc1a 100644 --- a/src/game/world/chunk.rs +++ b/src/game/world/chunk.rs @@ -9,7 +9,7 @@ use cgmath::Vector3; use lzzzz::lz4; use crate::game::world::{WorldBlock, block}; -pub const SIZE: usize = 32; +pub const SIZE: usize = 16; const SIZE_SQ: usize = SIZE*SIZE; const SIZE_QB: usize = SIZE*SIZE*SIZE; @@ -54,8 +54,8 @@ impl WorldChunk { // Blocks let timer = Instant::now(); - let mut block_bytes = vec![0_u8; num_blocks*SIZE_QB]; - lz4::decompress(&block_bytes_compressed, &mut block_bytes[0..num_blocks*SIZE_QB]).unwrap(); + let mut block_bytes = vec![0_u8; num_blocks*block::SIZE_QB]; + lz4::decompress(&block_bytes_compressed, &mut block_bytes[0..num_blocks*block::SIZE_QB]).unwrap(); let block_bytes = Arc::new(block_bytes); // Spawn workers diff --git a/src/game/world/mod.rs b/src/game/world/mod.rs index 00d8519..04e233e 100644 --- a/src/game/world/mod.rs +++ b/src/game/world/mod.rs @@ -101,11 +101,11 @@ impl World { // Try generating chunk let timer0 = Instant::now(); let mut chunk = WorldChunk::new(); - for x in 0..32 { - for z in 0..32 { + for x in 0..chunk::SIZE as i32 { + for z in 0..chunk::SIZE as i32 { let bpos = Vector3::{x,y:0,z}; let block = chunk.get_block_mut(&bpos); - WorldGen::generate(&(pos*32 + bpos), block); + WorldGen::generate(&(pos*chunk::SIZE as i32 + bpos), block); } }