diff --git a/tools/editor/cli_arg_required.cpp b/tools/editor/cli_arg_required.cpp index 0592974c..7c8a7096 100644 --- a/tools/editor/cli_arg_required.cpp +++ b/tools/editor/cli_arg_required.cpp @@ -94,6 +94,7 @@ const char* const kArgRequired[] = { "--gen-texture-moss", "--gen-texture-woodgrain", "--gen-texture-carbon", "--gen-texture-pinstripe", "--gen-texture-camo", "--gen-texture-snake-skin", + "--gen-texture-mesh-screen", "--validate-glb", "--info-glb", "--info-glb-tree", "--info-glb-bytes", "--validate-jsondbc", "--check-glb-bounds", "--validate-stl", "--validate-png", "--validate-blp", diff --git a/tools/editor/cli_gen_texture.cpp b/tools/editor/cli_gen_texture.cpp index 9fbcaa36..574385b5 100644 --- a/tools/editor/cli_gen_texture.cpp +++ b/tools/editor/cli_gen_texture.cpp @@ -3546,6 +3546,58 @@ int handleKnit(int& i, int argc, char** argv) { return 0; } +int handleMeshScreen(int& i, int argc, char** argv) { + // Orthogonal mesh-screen / grille: thin horizontal + vertical + // wires forming an axis-aligned grid. Distinct from + // --gen-texture-lattice (which uses ±45° diagonals to make + // diamond openings) — this is the right-angle window-screen / + // chain-link / sci-fi-grille look. + std::string outPath = argv[++i]; + std::string bgHex = argv[++i]; + std::string wireHex = argv[++i]; + int stride = 12; + int wireW = 2; + int W = 256, H = 256; + parseOptInt(i, argc, argv, stride); + parseOptInt(i, argc, argv, wireW); + parseOptInt(i, argc, argv, W); + parseOptInt(i, argc, argv, H); + if (W < 1 || H < 1 || W > 8192 || H > 8192 || + stride < 2 || stride > 1024 || + wireW < 1 || wireW * 2 >= stride) { + std::fprintf(stderr, + "gen-texture-mesh-screen: invalid dims (W/H 1..8192, " + "stride 2..1024, wireW 1..stride/2)\n"); + return 1; + } + uint8_t br_, bg_, bb_, wr, wg, wb_; + if (!parseHexOrError(bgHex, br_, bg_, bb_, + "gen-texture-mesh-screen")) return 1; + if (!parseHexOrError(wireHex, wr, wg, wb_, + "gen-texture-mesh-screen")) return 1; + std::vector pixels(static_cast(W) * H * 3, 0); + for (int y = 0; y < H; ++y) { + bool yOnWire = (y % stride) < wireW; + for (int x = 0; x < W; ++x) { + bool xOnWire = (x % stride) < wireW; + uint8_t r, g, b; + if (xOnWire || yOnWire) { + r = wr; g = wg; b = wb_; + } else { + r = br_; g = bg_; b = bb_; + } + setPixelRGB(pixels, W, x, y, r, g, b); + } + } + if (!savePngOrError(outPath, W, H, pixels, + "gen-texture-mesh-screen")) return 1; + std::printf("Wrote %s\n", outPath.c_str()); + std::printf(" size : %dx%d\n", W, H); + std::printf(" bg/wire : %s / %s\n", bgHex.c_str(), wireHex.c_str()); + std::printf(" grid : stride=%d, wireW=%d\n", stride, wireW); + return 0; +} + int handleSnakeSkin(int& i, int argc, char** argv) { // Snake skin: brick-offset grid of diamond-shaped scales. // Each scale is a rotated square in L1 (taxicab) metric so @@ -4527,6 +4579,7 @@ constexpr TextureEntry kTextureTable[] = { {"--gen-texture-pinstripe", 3, handlePinstripe}, {"--gen-texture-camo", 3, handleCamo}, {"--gen-texture-snake-skin", 3, handleSnakeSkin}, + {"--gen-texture-mesh-screen", 3, handleMeshScreen}, }; } // namespace diff --git a/tools/editor/cli_help.cpp b/tools/editor/cli_help.cpp index b88f8f26..96e00fa2 100644 --- a/tools/editor/cli_help.cpp +++ b/tools/editor/cli_help.cpp @@ -155,6 +155,8 @@ void printUsage(const char* argv0) { std::printf(" Camouflage: 2-octave value noise thresholded into hard bg/fg blobs (woodland disruption pattern)\n"); std::printf(" --gen-texture-snake-skin [cellW] [cellH] [outlineW] [W H]\n"); std::printf(" Snake skin: brick-offset diamond scales (L1 metric) with derived dark outline (reptile / dragon hide)\n"); + std::printf(" --gen-texture-mesh-screen [stride] [wireW] [W H]\n"); + std::printf(" Mesh-screen: orthogonal H+V wire grid (window screen / chain-link / sci-fi grille)\n"); std::printf(" --add-texture-to-zone [renameTo]\n"); std::printf(" Copy an existing PNG into (optionally renaming it on the way in)\n"); std::printf(" --gen-mesh [size]\n");