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:
1 parent
01c044805f
commit
7d4e0381fe
20 files changed
+3857
-1979
No files matched your search
@@ -89,6 +89,7 @@ is tested under both runtimes (luau `--codegen -O2` and LuaJIT through the build
|
||||
| model | schematic | .schem .schematic .litematic | yes | yes | voxels: true, blocks: true, variants: "schem", "schematic", "litematic" | `tests/model/schematic.luau` |
|
||||
| model | smd | .smd | yes | yes | skins: true, animation: true | `tests/model/smd.luau` |
|
||||
| model | stl | .stl | yes | yes | ascii: true, binary: true, colors: true, indexed: false | `tests/model/stl.luau` |
|
||||
| model | udmf | .udmf .textmap | yes | - | maps: true | `tests/model/udmf.luau` |
|
||||
| model | usda | .usda .usd .usdz | yes | yes | materials: true, animation: true, cameras: true, lights: true, polygons: true, vertexColors: true, usdz: "read", usdc: false | `tests/model/usda.luau` |
|
||||
| model | vox | .vox | yes | yes | voxels: true, sceneGraph: true, materials: true | `tests/model/vox.luau` |
|
||||
| model | vrml | .wrl .wrz .vrml | yes | yes | materials: true, polygons: true, animation: true, cameras: true, lights: true, lines: true, points: true | `tests/model/vrml.luau` |
|
||||
@@ -245,6 +246,7 @@ Codecs (layer 3, shared by formats; not loadable on their own), by domain:
|
||||
- codecs/image/Vp8L: WebP lossless (VP8L, RFC 9649 section 3).
|
||||
- codecs/image/Yuv: planar 4:2:0 Y'CbCr <-> rgba8, BT.601 / BT.709, limited or full range.
|
||||
- **model**
|
||||
- codecs/model/DoomMap: Doom / Heretic / Hexen binary map lumps (Hexen when BEHAVIOR is present) and UDMF TEXTMAP to
|
||||
- codecs/model/Draco: Google Draco geometry decompression (.drc; glTF KHR_draco_mesh_compression; Roblox mesh v6 / v7).
|
||||
- codecs/model/Mat4: 4x4 matrix (column-major, glTF / Types.Scene layout) and quaternion { x, y, z, w } helpers.
|
||||
- codecs/model/MeshFlatten: a Scene to one world-space mesh, for the writers of mesh-only formats (STL, PLY, OFF).
|
||||
@@ -256,6 +258,7 @@ Codecs (layer 3, shared by formats; not loadable on their own), by domain:
|
||||
- codecs/model/Vrml: VRML97 / X3D scene-graph engine (classic and XML encodings) for model/vrml and model/x3d.
|
||||
- **text**
|
||||
- codecs/text/Json: JSON (RFC 8259 / ECMA-404) parse and serialize, the engine data/json, glTF, TMJ, ... use. New code.
|
||||
- codecs/text/Lexer: C-style tokens for id Tech / UDMF text (idLib idLexer conventions, UDMF 1.1 §I; no code taken):
|
||||
- codecs/text/Nbt: Minecraft's Named Binary Tag format and SNBT (Minecraft wiki "NBT format", wiki.vg "NBT").
|
||||
- codecs/text/Text: text decoding helpers: BOM stripping, Windows-1252 for text that is not UTF-8, line splitting.
|
||||
- codecs/text/Url: RFC 3986 reference resolution (section 5.2), local-path classification and percent-encoding.
|
||||
|
||||
+4
-2
@@ -33,9 +33,9 @@ src/Rosetta/
|
||||
audio/ Aac Ac3 Adpcm Alac Ape ApeTag Flac Hively Mdct MidiRender Mpa Musepack Opus Pcm Qoa Resample
|
||||
SoundFont Stream Tracker Tta Vorbis VorbisComment WavPack
|
||||
video/ Dsp H263 H264 Legacy Mpeg1 Mpeg2 Theora Video (the video codec registry)
|
||||
text/ Json Nbt Text Url Xml
|
||||
text/ Json Lexer Nbt Text Url Xml
|
||||
font/ Bitmap Cff GlyphNames TrueType
|
||||
model/ Draco Mat4 MeshFlatten Minecraft Polygon Rbx Rig Sampler Vrml
|
||||
model/ DoomMap Draco Mat4 MeshFlatten Minecraft Polygon Rbx Rig Sampler Vrml
|
||||
host/ host (layer 2) runtime adapters; only the api uses them
|
||||
Types.luau types (layer 1) standard types + constructors
|
||||
core/ core (layer 0) Adler32 Base64 Bits Bytes Crc16 Crc32 Err Input
|
||||
@@ -242,6 +242,8 @@ them. Anything generic goes down a layer and is called:
|
||||
| GPU texture pixels (BCn, ETC / EAC, uncompressed texel layouts, half floats) | `codecs/image/Texture` (`Bcn`, `Etc`, `Texel`, `Half`) |
|
||||
| animation channels sampled at a time; game-model frames, joints and skins -> Scene | `codecs/model/Sampler`, `codecs/model/Rig` |
|
||||
| polygons with holes -> triangles | `codecs/model/Polygon` |
|
||||
| Doom-engine maps (binary lumps, UDMF) -> tables and a Scene | `codecs/model/DoomMap` |
|
||||
| C-style tokens (id Tech / UDMF text: comments, strings, numbers, words) | `codecs/text/Lexer` |
|
||||
| NBT / SNBT values; Minecraft block states and colours | `codecs/text/Nbt`, `codecs/model/Minecraft` |
|
||||
| Roblox instance trees and property values | `codecs/model/Rbx` |
|
||||
| bitmap fonts as a Font; PostScript glyph names | `codecs/font/Bitmap`, `codecs/font/GlyphNames` |
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) |
|
||||
|
||||
|
||||
Reference in new issue
Block a user