mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-16 03:19:07 +02:00
core/tile_mipmapper: fix file meta version for mipmap tiles
The meta version should only change when the outputs must be regenerated even if the inputs stay the same. This should never be the case for mipmap tiles, so we separate the meta version from map/lightmap tiles.
This commit is contained in:
parent
f79edb462c
commit
0988ebe095
2 changed files with 16 additions and 10 deletions
|
@ -70,12 +70,8 @@ impl<'a> TileMipmapper<'a> {
|
|||
/// Tile width/height
|
||||
const N: u32 = (BLOCKS_PER_CHUNK * CHUNKS_PER_REGION) as u32;
|
||||
|
||||
let version = match kind {
|
||||
TileKind::Map => REGION_FILE_META_VERSION,
|
||||
TileKind::Lightmap => LIGHTMAP_FILE_META_VERSION,
|
||||
};
|
||||
let output_path = self.config.tile_path(kind, level, coords);
|
||||
let output_timestamp = fs::read_timestamp(&output_path, version);
|
||||
let output_timestamp = fs::read_timestamp(&output_path, MIPMAP_FILE_META_VERSION);
|
||||
|
||||
let sources: Vec<_> = [(0, 0), (0, 1), (1, 0), (1, 1)]
|
||||
.into_iter()
|
||||
|
@ -149,11 +145,16 @@ impl<'a> TileMipmapper<'a> {
|
|||
);
|
||||
}
|
||||
|
||||
fs::create_with_timestamp(&output_path, version, input_timestamp, |file| {
|
||||
image
|
||||
.write_to(file, image::ImageFormat::Png)
|
||||
.context("Failed to save image")
|
||||
})?;
|
||||
fs::create_with_timestamp(
|
||||
&output_path,
|
||||
MIPMAP_FILE_META_VERSION,
|
||||
input_timestamp,
|
||||
|file| {
|
||||
image
|
||||
.write_to(file, image::ImageFormat::Png)
|
||||
.context("Failed to save image")
|
||||
},
|
||||
)?;
|
||||
|
||||
count_processed.send(()).unwrap();
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue