diff --git a/tools/editor/wowee_terrain.cpp b/tools/editor/wowee_terrain.cpp index 5be59fbd..67727f31 100644 --- a/tools/editor/wowee_terrain.cpp +++ b/tools/editor/wowee_terrain.cpp @@ -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 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; diff --git a/tools/editor/wowee_terrain.hpp b/tools/editor/wowee_terrain.hpp index 695a4bc8..7c88f694 100644 --- a/tools/editor/wowee_terrain.hpp +++ b/tools/editor/wowee_terrain.hpp @@ -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); };