diff --git a/src/bin/minedmap/tile_renderer.rs b/src/bin/minedmap/tile_renderer.rs index 8988425..50105cd 100644 --- a/src/bin/minedmap/tile_renderer.rs +++ b/src/bin/minedmap/tile_renderer.rs @@ -8,7 +8,7 @@ use num_integer::div_mod_floor; use minedmap::{ io::{fs, storage}, - resource::block_color, + resource::{block_color, Biome}, types::*, }; @@ -37,6 +37,27 @@ fn coord_offset( ) } +fn biome_at( + region_group: &RegionGroup, + chunk: ChunkCoords, + block: LayerBlockCoords, + dx: i32, + dz: i32, +) -> Option<&Biome> { + let (region_x, chunk_x, block_x) = coord_offset(chunk.x, block.x, dx); + let (region_z, chunk_z, block_z) = coord_offset(chunk.z, block.z, dz); + let chunk = ChunkCoords { + x: chunk_x, + z: chunk_z, + }; + let block = LayerBlockCoords { + x: block_x, + z: block_z, + }; + let region = region_group.get(region_x, region_z)?; + region[chunk].as_ref()?.biomes[block].as_ref() +} + pub struct TileRenderer<'a> { config: &'a Config, }