mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-12 09:59:05 +02:00
minedmap: add region cache
Cache the last loaded processed regions.
This commit is contained in:
parent
521e799d4b
commit
84bee6d6d9
4 changed files with 77 additions and 14 deletions
|
@ -10,7 +10,7 @@ use std::path::PathBuf;
|
|||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
|
||||
use common::Config;
|
||||
use common::{Config, TileCoords};
|
||||
use metadata_writer::MetadataWriter;
|
||||
use region_processor::RegionProcessor;
|
||||
use tile_mipmapper::TileMipmapper;
|
||||
|
@ -28,7 +28,11 @@ fn main() -> Result<()> {
|
|||
let args = Args::parse();
|
||||
let config = Config::new(args);
|
||||
|
||||
let regions = RegionProcessor::new(&config).run()?;
|
||||
let mut regions = RegionProcessor::new(&config).run()?;
|
||||
|
||||
// Sort regions in a zig-zag pattern to optimize cache usage
|
||||
regions.sort_unstable_by_key(|&TileCoords { x, z }| (x, if x % 2 == 0 { z } else { -z }));
|
||||
|
||||
TileRenderer::new(&config).run(®ions)?;
|
||||
let tiles = TileMipmapper::new(&config).run(®ions)?;
|
||||
MetadataWriter::new(&config).run(tiles)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue