model/d3map: Doom 3 / Quake 4 editor .map (Version 2 / 3): brushDef3 through codecs/model/Brush, patchDef2 / 3 through codecs/model/Patch, entities as nodes; side areas checked against qhull

This commit is contained in:
4DBug committed 2026-11-01 19:06:29 -06:00
1 parent 4bd59a30c8
commit 0f0da6e8ea
13 files changed
+2945 -1101

No files matched your search

+14
View File
@@ -535,6 +535,13 @@ A compiled `.proc` file (dmap's render geometry: `mapProcFile003`, Quake 4's `PR
materials are URIs. id Tech 4 triangles are clockwise-front, so they are turned counter-clockwise. The portals between
areas, the BSP nodes and the shadow models load as data in `meta.proc`.
The editor's `.map` (`Version 2` for Doom 3, `Version 3` for Quake 4; told apart from Quake's `.map` by that line)
loads as a Scene too: `brushDef3` brushes (plane equations) become polygons through the same brush clipper as the
Quake maps, with Doom 3's texture matrices, and `patchDef2` / `patchDef3` surfaces become triangle grids (patchDef3 at
its stored subdivisions, patchDef2 at `patchLevel` segments per sub-patch). Each entity is a node with its keys in
`extras.keys`; entities with geometry get a mesh (in world coordinates), point entities their `origin`, `rotation`
or `angle`. `skip` leaves materials out (`"textures/common/caulk"`), `hull` drops faces hidden inside other brushes.
```luau
local level = assert(F.model.load(procText))
assert(level.meshes[1].name == "_area0" and level.meta.up == "z")
@@ -542,6 +549,12 @@ local proc = level.meta.proc
assert(proc.areas == 2 and proc.portals[1].positive == 1 and #proc.portals[1].points == 12)
assert(proc.nodes[1].negative == -1) -- < 0: area -1 - n; > 0: a node (1-based); 0: solid
assert(level.materials[1].name == "textures/base_wall/lfwall1")
local room = assert(F.model.load(d3mapText, { name = "room.map", skip = { "textures/common/caulk" } }))
assert(room.meta.source.format == "d3map" and room.meta.source.variant == "doom3")
assert(#room.meshes[1].primitives == 1) -- the floor material; caulk skipped
local start = room.nodes[3]
assert(start.extras.classname == "info_player_start" and start.translation[3] == 1)
```
## Blitz3D (B3D)
@@ -784,6 +797,7 @@ assert(back.meshes[1].primitives[1].indices.count == 3)
| MD2, MD3, MDL, MD5, BSP | yes | - | game models and maps: see "Game models" above |
| SMD | yes | yes | Valve studiomdl data |
| Doom 3 / Quake 4 `.proc` | yes | | render geometry per area, portals and BSP nodes as data |
| Doom 3 / Quake 4 `.map` (d3map) | yes | | brushDef3, patchDef2 / 3, entities as nodes |
| 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) |