merge ws/build
This commit is contained in:
commit
9ae847d2a3
22 files changed
+6770
-1123
No files matched your search
@@ -6,6 +6,7 @@ is tested under both runtimes (luau `--codegen -O2` and LuaJIT through the build
|
||||
| Category | Format | Extensions | Read | Write | Capabilities | Test |
|
||||
|---|---|---|---|---|---|---|
|
||||
| image | ani | .ani | yes | yes | alpha: true, animation: true, frames: true | `tests/image/ani.luau` |
|
||||
| image | art | .art | yes | yes | alpha: true, palette: true, frames: true, depths: 8 | `tests/image/art.luau` |
|
||||
| image | blp | .blp | yes | yes | alpha: true, variants: "blp1", "blp2", compressions: "jpeg", "palette", "dxt1", "dxt3", "dxt5", "bgra" | `tests/image/blp.luau` |
|
||||
| image | bmp | .bmp .dib | yes | yes | alpha: true, depths: 1, 2, 4, 8, 16, 24, 32, rle: true | `tests/image/bmp.luau` |
|
||||
| image | dds | .dds | yes | yes | alpha: true, float: true, mipmaps: true, cubemap: true, compressed: "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7" | `tests/image/dds.luau` |
|
||||
@@ -66,6 +67,7 @@ is tested under both runtimes (luau `--codegen -O2` and LuaJIT through the build
|
||||
| model | 3mf | .3mf | yes | yes | materials: true, vertexColors: true, textures: true, units: true | `tests/model/3mf.luau` |
|
||||
| model | b3d | .b3d | yes | - | materials: true, textures: true, skins: true, animation: true, colors: true | `tests/model/b3d.luau` |
|
||||
| model | bsp | .bsp | yes | - | variants: "quake", "halflife", "quake2", "quake3", lightmaps: "quake3" | `tests/model/bsp.luau` |
|
||||
| model | buildmap | .map | yes | yes | sprites: true, slopes: true | `tests/model/buildmap.luau` |
|
||||
| model | dae | .dae .zae | yes | yes | materials: true, polygons: true, skins: true, morphTargets: true, animation: true, cameras: true, lights: true, zae: true | `tests/model/dae.luau` |
|
||||
| model | fbx | .fbx | yes | yes | binary: true, ascii: true, materials: true, animation: true, skins: true, morphTargets: true, cameras: true, lights: true, polygons: true | `tests/model/fbx.luau` |
|
||||
| model | gltf | .gltf .glb | yes | yes | binary: true, materials: true, animation: true, skins: true, morphTargets: true, cameras: true, lights: true, draco: true | `tests/model/gltf.luau` |
|
||||
|
||||
+19
-1
@@ -1,7 +1,7 @@
|
||||
# Images
|
||||
|
||||
Every image format (PNG / APNG, JPEG, WebP, GIF, BMP, TGA, QOI, TIFF, ICO / CUR, PNM / PAM / PFM, Radiance HDR,
|
||||
OpenEXR, the [game textures](#game-textures) DDS / KTX / VTF / BLP / TIM, and the [older formats](#formats) PCX, SGI,
|
||||
OpenEXR, the [game textures](#game-textures) DDS / KTX / VTF / BLP / TIM / ART, and the [older formats](#formats) PCX, SGI,
|
||||
Sun Raster, ILBM, XPM, XBM, ICNS, ANI) loads as one `Image`: a width, a height, a pixel format and one tightly packed `buffer`. Animations (GIF, APNG, animated
|
||||
WebP) and multi-image files (TIFF pages, ICO entries) add a list of `Frame`s. Editing goes through `F.ops.image`.
|
||||
|
||||
@@ -214,6 +214,23 @@ local small = assert(F.image.load(vtfBytes, { mip = 1 })) -- or face = n (cub
|
||||
assert(F.detect(tim) == "tim")
|
||||
```
|
||||
|
||||
Build engine ART files (`TILES000.ART` ..., Duke Nukem 3D, Shadow Warrior) hold many tiles: each is one entry of
|
||||
`frames` (in tile order, empty tiles 0 x 0), with its tile number in `meta.tile` and its picanm animation and centre
|
||||
offsets in `meta.picanm`; the top-level image is the first non-empty tile. Colours come from the game's
|
||||
`PALETTE.DAT`, passed as `palette` or found next to the file through `resolve` (without it the tiles decode as a grey
|
||||
ramp). Index 255 is transparent. `shade` / `pal` apply a PALETTE.DAT shade table / a LOOKUP.DAT palookup, `native`
|
||||
keeps the palette indices (gray8), and ART writes back from either form:
|
||||
|
||||
```luau
|
||||
local tiles = assert(F.image.load(artBytes, { palette = paletteBytes }))
|
||||
local second = tiles.frames[2].image
|
||||
assert(second.meta.tile == 1 and second.width == 8)
|
||||
assert(second.meta.picanm.type == "forward" and second.meta.picanm.frames == 2)
|
||||
local raw = assert(F.image.load(artBytes, { format = "art", native = true }))
|
||||
assert(raw.frames[1].image.format == "gray8")
|
||||
assert(buffer.tostring(assert(F.save(raw, nil, { format = "art" }))) == buffer.tostring(artBytes))
|
||||
```
|
||||
|
||||
Doom's graphics come from WAD lumps rather than files: `F.format("wad").image(wad, name)` (see
|
||||
[archive.md](archive.md#game-archives)).
|
||||
|
||||
@@ -233,6 +250,7 @@ Read and write unless noted; see [FORMATS.md](../FORMATS.md) for depths and deta
|
||||
| TIM | | yes | PlayStation; 4 / 8-bit CLUT, 15 / 24-bit |
|
||||
| BLP | | yes | Blizzard BLP1 / BLP2 (DXT through the BCn codec); writes BLP2 BGRA |
|
||||
| VTF | frames | yes | Valve; read only; mips / faces / slices by option |
|
||||
| ART | tiles as frames | index 255 | Build engine tiles; palette from PALETTE.DAT (`palette` / `resolve`), picanm in `meta.picanm` |
|
||||
| DDS, KTX / KTX2 | faces / layers / slices | yes | GPU textures: BC1..BC7, ETC / EAC, every uncompressed layout; mips in `meta.mipmaps` |
|
||||
| OpenEXR | parts (`opts.part`) | yes | half / float / uint, NONE / RLE / ZIPS / ZIP / PIZ, tiles; writes NONE / ZIPS / ZIP |
|
||||
| PCX, SGI, Sun Raster, IFF ILBM / PBM, XPM, XBM | | yes (XBM 1-bit) | old paint / workstation formats; ILBM reads HAM and EHB |
|
||||
|
||||
@@ -507,6 +507,29 @@ local again = assert(F.save(barney, nil, { format = "smd" })) -- SMD writes ba
|
||||
assert(F.model.load(again).skins[1])
|
||||
```
|
||||
|
||||
## Build engine maps
|
||||
|
||||
Duke Nukem 3D / Shadow Warrior `.map` files (versions 7-9; the text Quake `.map` is a different format, told apart by
|
||||
content) load as one mesh: floors and ceilings triangulated with their slopes, walls with upper and lower parts at red
|
||||
walls (and masked walls), a primitive per surface kind and tile (`extras.build = { kind, tile }`); materials and
|
||||
textures are named `tile<n>`. Sprites become nodes under the map with their tile in `extras.build.tile` (the raw
|
||||
sprite in `extras.build.sprite`), and the player start is the node `start`. Coordinates turn z up (Build's y and z
|
||||
point down), z is divided by 16 so all axes share Build's xy unit, and `scale` multiplies everything. `tiles` (tile
|
||||
number to Image, e.g. from an ART file) gives the texture sizes for the UVs and attaches the images.
|
||||
|
||||
The raw sector, wall and sprite tables stay in `meta.build`, and saving writes them back:
|
||||
|
||||
```luau
|
||||
local map = assert(F.model.load(buildmapBytes, { scale = 1 / 512 }))
|
||||
local level = map.meta.build
|
||||
assert(level.version == 7 and #level.sectors == 3)
|
||||
assert(map.nodes[2].name == "start" and map.nodes[3].extras.build.tile == level.sprites[1].picnum)
|
||||
local again = assert(F.save(map, nil, { format = "buildmap" }))
|
||||
assert(buffer.tostring(again) == buffer.tostring(buildmapBytes))
|
||||
local Build = F.format("buildmap") -- the floor height under a point, slopes included
|
||||
assert(Build.slopeZ(level, 0, true, 100, 100) == level.sectors[1].floorz)
|
||||
```
|
||||
|
||||
## Blitz3D (B3D)
|
||||
|
||||
`.b3d` files (Blitz3D, also written by many old game tools) load read-only. The node tree keeps its names and TRS;
|
||||
@@ -745,6 +768,7 @@ assert(back.meshes[1].primitives[1].indices.count == 3)
|
||||
| X3D (XML / classic) | yes | yes | the VRML reader plus the X3D triangle / quad / line sets; no binary `.x3db` |
|
||||
| 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 |
|
||||
| Build engine MAP (v7-9) | yes | yes | sloped sectors, walls, sprites as nodes, raw tables in `meta.build`; see "Build engine maps" above |
|
||||
| SMD | yes | yes | Valve studiomdl data |
|
||||
| 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