bug fixes
This commit is contained in:
@@ -28,6 +28,14 @@ impl App {
|
|||||||
let block = app.world.gen_block(pos);
|
let block = app.world.gen_block(pos);
|
||||||
content.write(pos, block);
|
content.write(pos, block);
|
||||||
|
|
||||||
|
let pos = &Point3{x:1,y:0,z:0};
|
||||||
|
let block = app.world.gen_block(pos);
|
||||||
|
content.write(pos, block);
|
||||||
|
|
||||||
|
let pos = &Point3{x:0,y:0,z:1};
|
||||||
|
let block = app.world.gen_block(pos);
|
||||||
|
content.write(pos, block);
|
||||||
|
|
||||||
println!("App initialized");
|
println!("App initialized");
|
||||||
app
|
app
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ impl WorldGen {
|
|||||||
// Fill
|
// Fill
|
||||||
for x in 0..block::SIZE {
|
for x in 0..block::SIZE {
|
||||||
for z in 0..block::SIZE {
|
for z in 0..block::SIZE {
|
||||||
//let h = map[x][z];
|
let h = map[x][z];
|
||||||
let h = 16; // testing
|
//let h = 16; // testing
|
||||||
for y in 0..h {
|
for y in 0..h {
|
||||||
block.set(Point3{x, y, z}, 2);
|
block.set(Point3{x, y, z}, 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ impl World {
|
|||||||
let ch_pos = block_pos / chunk::SIZE;
|
let ch_pos = block_pos / chunk::SIZE;
|
||||||
let bl_pos = block_pos % chunk::SIZE;
|
let bl_pos = block_pos % chunk::SIZE;
|
||||||
// Create chunk if does not exist
|
// Create chunk if does not exist
|
||||||
if let None = self.chunks.get_mut(&ch_pos) {
|
if let None = self.chunks.get(&ch_pos) {
|
||||||
self.chunks.insert(block_pos.clone(), WorldChunk::new());
|
self.chunks.insert(block_pos.clone(), WorldChunk::new());
|
||||||
}
|
}
|
||||||
// Generate block for chunk
|
// Generate block for chunk
|
||||||
let chunk = self.chunks.get_mut(block_pos).unwrap();
|
let chunk = self.chunks.get_mut(&ch_pos).unwrap();
|
||||||
let block = chunk.get_block(&bl_pos);
|
let block = chunk.get_block(&bl_pos);
|
||||||
WorldGen::generate(&bl_pos, block);
|
WorldGen::generate(&bl_pos, block);
|
||||||
block
|
block
|
||||||
|
|||||||
Reference in New Issue
Block a user