dumb iterator implemented ith faster hashmap
This commit is contained in:
parent
7879e57275
commit
31d56ded3f
3 changed files with 13 additions and 4 deletions
src
|
@ -4,6 +4,7 @@ use anyhow::Result;
|
|||
use cgmath::{vec2, vec3};
|
||||
|
||||
use std::collections::HashMap;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::app_data::AppData;
|
||||
use crate::buffer;
|
||||
|
@ -13,7 +14,7 @@ use crate::primitives::cube::Cube;
|
|||
extern crate rand;
|
||||
use rand::Rng;
|
||||
|
||||
const CHUNK_SIZE: usize = 100;
|
||||
const CHUNK_SIZE: usize = 500;
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct Scene {
|
||||
|
@ -80,12 +81,12 @@ impl Scene {
|
|||
#[derive(Clone, Debug)]
|
||||
struct Chunk {
|
||||
//todo change to hashmap?
|
||||
blocks: HashMap<cgmath::Vector3<u32>, Cube>,
|
||||
blocks: HashMap<cgmath::Vector3<u32>, Cube, rustc_hash::FxBuildHasher>,
|
||||
}
|
||||
|
||||
impl Chunk {
|
||||
pub fn create() -> Result<Self> {
|
||||
let mut map = HashMap::new();
|
||||
let mut map: HashMap<cgmath::Vector3<u32>, Cube, rustc_hash::FxBuildHasher> = FxHashMap::default();
|
||||
Ok(Self {
|
||||
blocks: map
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue