mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 09:03:52 +00:00
feat(editor): hole mask PNG export (16x16 chunk grid, white=holes)
This commit is contained in:
parent
b65b5a758d
commit
1a95ec9d0a
2 changed files with 16 additions and 0 deletions
|
|
@ -182,6 +182,18 @@ bool WoweeTerrain::exportWaterMask(const pipeline::ADTTerrain& terrain,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool WoweeTerrain::exportHoleMask(const pipeline::ADTTerrain& terrain,
|
||||
const std::string& path) {
|
||||
constexpr int res = 16;
|
||||
std::vector<uint8_t> pixels(res * res);
|
||||
for (int ci = 0; ci < 256; ci++)
|
||||
pixels[ci] = (terrain.chunks[ci].holes != 0) ? 255 : 0;
|
||||
|
||||
std::filesystem::create_directories(std::filesystem::path(path).parent_path());
|
||||
stbi_write_png(path.c_str(), res, res, 1, pixels.data(), res);
|
||||
return true;
|
||||
}
|
||||
|
||||
int WoweeTerrain::exportAlphaMaps(const pipeline::ADTTerrain& terrain,
|
||||
const std::string& outputDir) {
|
||||
namespace fs = std::filesystem;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ public:
|
|||
static bool exportWaterMask(const pipeline::ADTTerrain& terrain,
|
||||
const std::string& path);
|
||||
|
||||
// Export hole mask as PNG (white=hole, black=solid)
|
||||
static bool exportHoleMask(const pipeline::ADTTerrain& terrain,
|
||||
const std::string& path);
|
||||
|
||||
// Import terrain from open format back to ADTTerrain
|
||||
static bool importOpen(const std::string& basePath, pipeline::ADTTerrain& terrain);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue