chunk rebuilder system

refactoring
This commit is contained in:
2024-05-06 22:26:30 -04:00
parent cd4c9f2acf
commit 58a9f62dca
12 changed files with 195 additions and 41 deletions

View File

@@ -11,8 +11,6 @@ use bevy::{
},
};
pub fn generate_chunk_mesh(
chunk: &Chunk,
map: &Map,
@@ -33,9 +31,8 @@ pub fn generate_chunk_mesh(
let temperature = chunk.temperature[x + z * Chunk::SIZE];
let off_pos = Vec3::new(x as f32, height, z as f32);
let tile_pos = offset3d_to_world(off_pos);
let coord = HexCoord::from_offset(
IVec2::new(x as i32, z as i32) + (chunk.chunk_offset * Chunk::SIZE as i32),
);
let coord =
HexCoord::from_offset(IVec2::new(x as i32, z as i32) + (chunk.chunk_offset * Chunk::SIZE as i32));
let n = map.get_neighbors(&coord);
let biome = mappers.get(painter.sample_biome(moisture, temperature));
let tile_handle = biome.unwrap().sample_tile(height);