mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-04 06:39:07 +02:00
tile_mipmapper: store tile coordinates in nested map/set
Use the same data structure as the frontend.
This commit is contained in:
parent
216aa6ceec
commit
b63a18ad6f
2 changed files with 50 additions and 17 deletions
|
@ -1,4 +1,5 @@
|
|||
use std::{
|
||||
collections::{BTreeMap, BTreeSet},
|
||||
fmt::Debug,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
@ -19,6 +20,19 @@ impl Debug for TileCoords {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct TileCoordMap(pub BTreeMap<i32, BTreeSet<i32>>);
|
||||
|
||||
impl TileCoordMap {
|
||||
pub fn contains(&self, coords: TileCoords) -> bool {
|
||||
let Some(xs) = self.0.get(&coords.z) else {
|
||||
return false;
|
||||
};
|
||||
|
||||
xs.contains(&coords.x)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ProcessedChunk {
|
||||
pub blocks: Box<layer::BlockArray>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue