codecs/model/DoomMap: the Doom map-to-Scene builder moved out of archive/wad, plus a UDMF 1.1 TEXTMAP parser (fields kept, namespace flag bits); Wad.map loads UDMF maps; model/udmf for a standalone TEXTMAP; codecs/text/Lexer (C-style tokens for id Tech / UDMF text)

STYLE.md: layout block and the 2a table list DoomMap and Lexer. tests/archive/wad: the UDMF stub map now loads (empty) instead of UNSUPPORTED.
This commit is contained in:
4DBug committed 2026-11-01 18:33:24 -06:00
1 parent 01c044805f
commit 7d4e0381fe
20 files changed
+3857 -1979

No files matched your search

+1 -1
View File
@@ -210,7 +210,7 @@ assert(F.archive.load(bytes):read("maps/e1m1.bsp"))
A WAD's lumps keep their order; lumps of a map are named `"<map>/<lump>"` (`"E1M1/THINGS"`) and repeated names get
`"~2"`, `"~3"`, ... so every entry is unique (writing strips both again). The format module turns lumps into game
data: graphics (flats, patches, sprites, menu pictures) into Images through the `PLAYPAL` palette, wall textures
composed from their patches, and maps into a Scene (z up, map units: floors and ceilings triangulated from the
composed from their patches, and maps (binary lumps or UDMF `TEXTMAP`) into a Scene (z up, map units: floors and ceilings triangulated from the
sector outlines, walls, things as nodes standing on their floor).
```luau
+21
View File
@@ -507,6 +507,26 @@ local again = assert(F.save(barney, nil, { format = "smd" })) -- SMD writes ba
assert(F.model.load(again).skins[1])
```
## Doom maps (UDMF)
Doom-engine maps load as Scenes (z up, map units): floors and ceilings triangulated from the sector outlines, walls
with vanilla texture alignment, things as child nodes standing on their floor. Maps inside a WAD (binary lumps or a
UDMF `TEXTMAP`) load through `F.format("wad").map(wad, name)` (see the archive page); a standalone UDMF text
(`.udmf`, or a `TEXTMAP` lump saved alone) loads directly, with texture sizes from `textureSize` (else 64 x 128 walls
and 64 x 64 flats) and the textures as URIs. `F.format("udmf").data` gives the tables: every UDMF block keeps its
fields as written (`fields`, lower-case keys: namespace and `user_` keys too), flags are rebuilt in the binary layout
(Doom bits for the Doom / Heretic / Strife namespaces, Hexen bits otherwise), and unknown blocks stay in `blocks`.
```luau
local room = assert(F.model.load(udmfText))
assert(room.meta.source.format == "udmf" and room.meta.source.namespace == "ZDoom")
assert(room.nodes[3].translation[3] == 40) -- a thing 8 units above the 32-unit pillar
local Udmf = F.format("udmf")
local data = assert(Udmf.data(F.Bytes.reader(buffer.fromstring(udmfText))))
assert(data.sectors[1].fields.user_gravity == 0.5)
assert(data.linedefs[4].tag == 7 and data.blocks[1].type == "vavoombox")
```
## Blitz3D (B3D)
`.b3d` files (Blitz3D, also written by many old game tools) load read-only. The node tree keeps its names and TRS;
@@ -746,6 +766,7 @@ assert(back.meshes[1].primitives[1].indices.count == 3)
| STEP | via the CAD plug-in | | see [cad.md](cad.md) |
| MD2, MD3, MDL, MD5, BSP | yes | - | game models and maps: see "Game models" above |
| SMD | yes | yes | Valve studiomdl data |
| UDMF (`.udmf`, `TEXTMAP`) | yes | | Doom maps as text: see "Doom maps (UDMF)" above |
| Roblox `.mesh` (robloxmesh) | yes | yes | see [roblox.md](roblox.md) |
| Roblox `.rbxm` / `.rbxl`, `.rbxmx` / `.rbxlx` | as an `RbxTree` | yes | instance trees with typed properties: see [roblox.md](roblox.md) |