mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-05 17:44:52 +01:00
main: factor out overlay_chunk() function to build region images
This commit is contained in:
parent
51602d5fc1
commit
202364bfca
1 changed files with 14 additions and 6 deletions
20
src/main.rs
20
src/main.rs
|
@ -59,6 +59,19 @@ impl Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn overlay_chunk<I, J>(image: &mut I, chunk: &J, coords: ChunkCoords)
|
||||||
|
where
|
||||||
|
I: image::GenericImage,
|
||||||
|
J: image::GenericImageView<Pixel = I::Pixel>,
|
||||||
|
{
|
||||||
|
image::imageops::overlay(
|
||||||
|
image,
|
||||||
|
chunk,
|
||||||
|
coords.x.0 as i64 * BLOCKS_PER_CHUNK as i64,
|
||||||
|
coords.z.0 as i64 * BLOCKS_PER_CHUNK as i64,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Type with methods for processing the regions of a Minecraft save directory
|
/// Type with methods for processing the regions of a Minecraft save directory
|
||||||
struct RegionProcessor<'a> {
|
struct RegionProcessor<'a> {
|
||||||
block_types: resource::BlockTypes,
|
block_types: resource::BlockTypes,
|
||||||
|
@ -209,12 +222,7 @@ impl<'a> TileRenderer<'a> {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
image::imageops::overlay(
|
overlay_chunk(image, &chunk_image, coords);
|
||||||
image,
|
|
||||||
&chunk_image,
|
|
||||||
coords.x.0 as i64 * BLOCKS_PER_CHUNK as i64,
|
|
||||||
coords.z.0 as i64 * BLOCKS_PER_CHUNK as i64,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_region(image: &mut image::RgbaImage, region: &ProcessedRegion) {
|
fn render_region(image: &mut image::RgbaImage, region: &ProcessedRegion) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue