Pausing rendering, warnings cleanup, more statistics

This commit is contained in:
Piotrek
2021-05-10 15:36:11 +02:00
parent 4eaa0fab56
commit a09f446ecd
10 changed files with 84 additions and 79 deletions
+4 -6
View File
@@ -1,19 +1,17 @@
mod generator;
pub mod chunk;
pub mod block;
use std::time::Instant;
use linked_hash_map::LinkedHashMap;
use std::path::PathBuf;
use std::path::Path;
use std::io::Write;
use std::io::Read;
use std::fs;
use cgmath::{Point3, InnerSpace};
use cgmath::Point3;
use std::collections::HashMap;
use generator::WorldGen;
use chunk::WorldChunk;
use block::WorldBlock;
use yaml_rust::{Yaml, YamlLoader, YamlEmitter};
use yaml_rust::{Yaml, YamlEmitter};
pub struct World {
@@ -101,7 +99,7 @@ impl World {
file.read_to_end(&mut bytes).expect("Failed to read file");
let chunk = WorldChunk::from_bytes(bytes);
println!("loaded {:?}", pos);
println!("Load: Chunk {}, {}, {}", pos.x, pos.y, pos.z);
self.chunks.insert(pos, chunk);
count += 1;
}
@@ -117,7 +115,7 @@ impl World {
// Create chunk if does not exist
if let None = self.chunks.get(&ch_pos) {
self.chunks.insert(ch_pos.clone(), WorldChunk::new());
println!("Alloc chunk [{}, {}, {}]", ch_pos.x, ch_pos.y, ch_pos.z);
println!("Alloc: Chunk [{}, {}, {}]", ch_pos.x, ch_pos.y, ch_pos.z);
}
// Generate block for chunk
let chunk = self.chunks.get_mut(&ch_pos).unwrap();