Store per-region biome list in IndexSet

Index into the biome list instead of duplicating the biome data for each
coordinate. This reduces the size of the processed data and speeds up
encoding/decoding.
This commit is contained in:
Matthias Schiffer 2023-08-03 21:27:08 +02:00
parent c38f00e411
commit fb712cd2f5
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
8 changed files with 70 additions and 18 deletions

View file

@ -4,9 +4,10 @@ use std::{
path::{Path, PathBuf},
};
use indexmap::IndexSet;
use serde::{Deserialize, Serialize};
use minedmap::{io::fs::FileMetaVersion, types::*, world::layer};
use minedmap::{io::fs::FileMetaVersion, resource::Biome, types::*, world::layer};
// Increase to force regeneration of all output files
pub const FILE_META_VERSION: FileMetaVersion = FileMetaVersion(0);
@ -43,7 +44,12 @@ pub struct ProcessedChunk {
pub biomes: Box<layer::BiomeArray>,
pub depths: Box<layer::DepthArray>,
}
pub type ProcessedRegion = ChunkArray<Option<ProcessedChunk>>;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ProcessedRegion {
pub biome_list: IndexSet<Biome>,
pub chunks: ChunkArray<Option<ProcessedChunk>>,
}
pub struct Config {
pub region_dir: PathBuf,