docs(atlas-baker): sprite-mode section + flag-table per-mode + version 0.3.0

This commit is contained in:
Axel Meyer
2026-06-16 21:37:36 +02:00
parent f1447b68aa
commit 0780f90c58
2 changed files with 49 additions and 14 deletions

View File

@@ -23,23 +23,58 @@ sporel-atlas-baker \
[--verbose] [--verbose]
``` ```
### Modes
The baker supports two output topologies:
| Mode | Default | Output |
|---|---|---|
| `tilemap` (default) | Paired diffuse + height tiles on a fixed grid (blob-14 + collision sidecar supported) | `<atlas>.diffuse.png` + `<atlas>.height.png` + `<atlas>.atlas.json` + `<atlas>.atlas.lock.json` |
| `sprite` | Diffuse-only, unregelmäßige Einzel-Sprites | `<atlas>/sprites.diffuse.atlas.png` + `<atlas>/sprites.uv.json` + `<atlas>/sprites.atlas.lock.json` |
Select via `--mode {tilemap|sprite}`. tilemap-mode is the default for
backward compatibility with v0.2.0 call-sites.
### Flags ### Flags
| Flag | Meaning | | Flag | Tilemap | Sprite | Meaning |
| --- | --- | | --- | --- | --- | --- |
| `--in <source-dir>` | Directory of source tile images. | | `--in <source-dir>` | required | required | Source directory. |
| `--out <atlas-dir>` | Output directory for the baked atlas + sidecars. | | `--out <atlas-dir>` | required | required | Output directory. |
| `--atlas-id <stable-id>` | Stable atlas identifier written into the lock. | | `--atlas-id <id>` | required | required | Stable atlas identifier. |
| `--tile-size <N\|auto>` | Tile edge length in pixels, or `auto` to infer it from the source tiles. | | `--mode {tilemap\|sprite}` | default | toggle | Output topology. |
| `--max-size <N>` | Maximum atlas dimension in pixels (default 4096). | | `--tile-size <N\|auto>` | yes | ignored | Tile edge length. |
| `--pad-px <N>` | Edge-replicated padding (gutter) applied around each tile, in pixels (Rev 4 §13.3). | | `--max-size <N>` | yes | yes | Max atlas dimension (default 4096). |
| `--schema <blob-14>` | Slot-validation schema for the source set. `blob-14` is the v0.2 14-slot blob schema (E1); required by lib-core.maps v0.5.1. | | `--pad-px <N>` | yes (default 2) | yes (default 1) | Per-tile/sprite padding. |
| `--lock <existing-lock.json>` | Reuse an existing lock to keep tile indices stable. | | `--schema blob-14` | yes | warn+ignore | Slot validation (E1+E2). |
| `--blocks-sight-pattern <regex>` | Regex matching tile names that block line of sight. | | `--strip-prefix "<s>"` | ignored | yes | Strip leading prefix from sprite filenames before alias normalisation. |
| `--verbose` | Print detailed per-tile diagnostics. | | `--lock <path>` | yes | yes | Reuse existing lock for stable IDs. |
| `--blocks-sight-pattern <re>` | yes | ignored | Regex matching tiles that block LOS. |
| `--verbose` | yes | yes | Detailed diagnostics. |
See `sporel-meta/docs/superpowers/specs/2026-05-21-map-multi-layer-design.md` §4 for the format spec. See `sporel-meta/docs/superpowers/specs/2026-05-21-map-multi-layer-design.md` §4 for the format spec.
### Sprite-Mode Output Format
`<out>/<atlas-id>/sprites.uv.json` carries the alias → UV table:
```json
{
"atlas_id": "tcbasics",
"atlas_size": [W, H],
"sprites": {
"bed1": { "x": 0, "y": 0, "w": 256, "h": 128, "source_file": "Bed1.png" },
"bench1": { "x": 256,"y": 0, "w": 192, "h": 96, "source_file": "Bench1.png" }
}
}
```
`sprites.atlas.lock.json` carries the stable alias-set + source-file
mapping; pass it via `--lock` on re-bakes to preserve alias ordering
when the input set grows. Removed aliases surface as `WARN`-lines on
stderr (dropped from the new lock; consumers referencing the dropped
alias will fail at sample-time).
## Development ## Development
```bash ```bash

View File

@@ -1,7 +1,7 @@
{ {
"name": "sporel-tool-atlas-baker", "name": "sporel-tool-atlas-baker",
"version": "0.2.0", "version": "0.3.0",
"description": "Bake paired diffuse + height PNG atlases for the Sporel map-lib v0.3.0+ format. v0.2: edge-replicated padding (Rev 4 §13.3), --schema blob-14 E1 slot validation, collision.json sidecar E2 validation + pass-through, alpha-analysis opaque flag. Accepts PNG/WebP/JPG via jimp.", "description": "Bake paired diffuse + height PNG atlases for the Sporel map-lib v0.3.0+ format. v0.2: edge-replicated padding (Rev 4 §13.3), --schema blob-14 E1 slot validation, collision.json sidecar E2 validation + pass-through, alpha-analysis opaque flag. Accepts PNG/WebP/JPG via jimp; v0.3 adds --mode sprite for diffuse-only atlases of irregularly-sized sprites with alias→UV-table sidecar",
"bin": { "bin": {
"sporel-atlas-baker": "bin/atlas-baker.js" "sporel-atlas-baker": "bin/atlas-baker.js"
}, },