ws-game: docs/guide sections (game archives, game models, game textures) with tested snippets (tools/fixtures/docs_game.py); bench lines (explode, mpq, wad map)
This commit is contained in:
1 parent
3d01293b82
commit
0b1c5ebfec
5 files changed
+267
No files matched your search
@@ -194,6 +194,28 @@ Encoder options:
|
||||
| ICO | `cursor`, `png` (PNG entries); `frames` become entries (each up to 256 x 256) |
|
||||
| PNM | the subtype from the extension or `format`: `pbm`, `pgm`, `ppm`, `pam`, `pfm` |
|
||||
|
||||
## Game textures
|
||||
|
||||
PlayStation TIM, Blizzard BLP and Valve VTF load as Images too (rgba8; the mip and texel facts in
|
||||
`meta.source`):
|
||||
|
||||
```luau
|
||||
local face = assert(F.image.load(timBytes)) -- 4 / 8-bit CLUT, 15 or 24-bit
|
||||
assert(face.meta.source.bpp == 16)
|
||||
local tim = assert(F.save(face, nil, { format = "tim", bpp = 16 })) -- TIM writes 4 / 8 / 16 / 24-bit
|
||||
|
||||
local icon = assert(F.image.load(blpBytes)) -- BLP1 JPEG / palette, BLP2 palette / DXT / BGRA
|
||||
assert(icon.width == 4 and icon.meta.source.compression == "bgra")
|
||||
|
||||
local wall = assert(F.image.load(vtfBytes)) -- every common VTF texel format, frames, mips
|
||||
assert(wall.meta.source.texel == "RGBA8888")
|
||||
local small = assert(F.image.load(vtfBytes, { mip = 1 })) -- or face = n (cube maps), slice = n (volumes)
|
||||
assert(F.detect(tim) == "tim")
|
||||
```
|
||||
|
||||
Doom's graphics come from WAD lumps rather than files: `F.format("wad").image(wad, name)` (see
|
||||
[archive.md](archive.md#game-archives)).
|
||||
|
||||
## Formats
|
||||
|
||||
Read and write unless noted; see [FORMATS.md](../FORMATS.md) for depths and details.
|
||||
@@ -207,6 +229,9 @@ Read and write unless noted; see [FORMATS.md](../FORMATS.md) for depths and deta
|
||||
| TIFF | pages | yes | 1..32-bit, float |
|
||||
| BMP, TGA, QOI, ICO / CUR, PNM / PAM / PFM | ICO entries | yes | |
|
||||
| HDR | | no | float (`native` gives rgbaf32) |
|
||||
| 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 |
|
||||
|
||||
An animated image also opens as a video (`F.video.open(gifBytes)`), and saves to a video format
|
||||
(`F.convert(gifBytes, "avi")`): see [video.md](video.md).
|
||||
|
||||
Reference in new issue
Block a user