From 1a95ec9d0a66acbba13806f7a0931edaa3950b6d Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 5 May 2026 11:43:23 -0700 Subject: [PATCH] feat(editor): hole mask PNG export (16x16 chunk grid, white=holes) --- tools/editor/wowee_terrain.cpp | 12 ++++++++++++ tools/editor/wowee_terrain.hpp | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/tools/editor/wowee_terrain.cpp b/tools/editor/wowee_terrain.cpp index 67727f31..8548d31e 100644 --- a/tools/editor/wowee_terrain.cpp +++ b/tools/editor/wowee_terrain.cpp @@ -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 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; diff --git a/tools/editor/wowee_terrain.hpp b/tools/editor/wowee_terrain.hpp index 7c88f694..c9b0e84d 100644 --- a/tools/editor/wowee_terrain.hpp +++ b/tools/editor/wowee_terrain.hpp @@ -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); };