mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-05 17:44:52 +01:00
Read biome maps when iterating regions
This commit is contained in:
parent
072d664199
commit
a3cf5edda4
1 changed files with 20 additions and 0 deletions
|
@ -225,17 +225,37 @@ static void makeMap(const std::string ®iondir, const std::string &outputdir,
|
||||||
std::string outname = formatTileName(x, z, "png");
|
std::string outname = formatTileName(x, z, "png");
|
||||||
std::string input = regiondir + "/" + inname;
|
std::string input = regiondir + "/" + inname;
|
||||||
std::string output = outputdir + "/map/0/" + outname, output_light = outputdir + "/light/0/" + outname;
|
std::string output = outputdir + "/map/0/" + outname, output_light = outputdir + "/light/0/" + outname;
|
||||||
|
std::string biomenames[3][3];
|
||||||
|
|
||||||
int64_t intime = getModTime(input);
|
int64_t intime = getModTime(input);
|
||||||
if (intime == INT64_MIN)
|
if (intime == INT64_MIN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < 3; i++) {
|
||||||
|
for (size_t j = 0; j < 3; j++) {
|
||||||
|
biomenames[i][j] = outputdir + "/biome/" + formatTileName(x + i - 1, z + j - 1, "png");
|
||||||
|
intime = std::max(intime, getModTime(biomenames[i][j]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!checkRegion(intime, output))
|
if (!checkRegion(intime, output))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::printf("Generating %s from %s...\n", output.c_str(), input.c_str());
|
std::printf("Generating %s from %s...\n", output.c_str(), input.c_str());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
std::unique_ptr<uint8_t[]> biomemaps[3][3];
|
||||||
|
for (size_t i = 0; i < 3; i++) {
|
||||||
|
for (size_t j = 0; j < 3; j++) {
|
||||||
|
biomemaps[i][j].reset(new uint8_t[DIM*DIM]);
|
||||||
|
std::memset(biomemaps[i][j].get(), 0, DIM*DIM);
|
||||||
|
|
||||||
|
try {
|
||||||
|
PNG::read(biomenames[i][j].c_str(), biomemaps[i][j].get(), DIM, DIM, PNG::GRAY);
|
||||||
|
} catch (const std::exception& ex) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<Resource::Color[]> image(new Resource::Color[DIM*DIM]);
|
std::unique_ptr<Resource::Color[]> image(new Resource::Color[DIM*DIM]);
|
||||||
std::memset(image.get(), 0, 4*DIM*DIM);
|
std::memset(image.get(), 0, 4*DIM*DIM);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue