mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 00:53:52 +00:00
feat(editor): water mask PNG export (16x16 chunk grid, white=water)
This commit is contained in:
parent
235eccad88
commit
7ce49ebe96
2 changed files with 16 additions and 0 deletions
|
|
@ -170,6 +170,18 @@ bool WoweeTerrain::exportHeightmapPreview(const pipeline::ADTTerrain& terrain,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool WoweeTerrain::exportWaterMask(const pipeline::ADTTerrain& terrain,
|
||||
const std::string& path) {
|
||||
constexpr int res = 16; // One pixel per chunk
|
||||
std::vector<uint8_t> pixels(res * res);
|
||||
for (int ci = 0; ci < 256; ci++)
|
||||
pixels[ci] = terrain.waterData[ci].hasWater() ? 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;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ public:
|
|||
static bool exportHeightmapPreview(const pipeline::ADTTerrain& terrain,
|
||||
const std::string& path);
|
||||
|
||||
// Export water mask as PNG (white=water, black=land)
|
||||
static bool exportWaterMask(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