codecs/model/Brush, codecs/model/Patch, codecs/image/Miptex; Pixels palette helpers

Brush: plane brushes -> polygons (qbsp-style clipping), Quake standard / Valve 220 / brush-primitive projection,
optional coplanar merge and CSG hull; tested against ericw-tools qbsp -nofill (area per plane, texels per corner).
Patch: Bezier control grids moved out of model/bsp/Quake3, per-axis subdivisions (patchDef2 / patchDef3), normals.
Miptex: Quake / GoldSrc miptex decode / encode and the WAD2 / WAD3 directory (model/bsp uses it now).
Pixels: grey, keyed, colorList, colormap, paletteBytes. STYLE: layout block and 2a table list the new modules.
This commit is contained in:
4DBug committed 2026-11-01 18:40:29 -06:00
1 parent 01c044805f
commit 5ad934565d
19 files changed
+4520 -923

No files matched your search

+4 -1
View File
@@ -236,7 +236,8 @@ Codecs (layer 3, shared by formats; not loadable on their own), by domain:
- codecs/image/Etc: ETC1 / ETC2 / EAC block texture decoding (Khronos Data Format Specification 1.3, section 21).
- codecs/image/Half: IEEE 754 binary16 <-> number (round to nearest even, overflow to infinity). New in rosetta.
- codecs/image/Jpeg: the JPEG codec (ITU T.81), bit-exact with libjpeg-turbo's djpeg and byte-identical with cjpeg.
- codecs/image/Pixels: row loops between packed pixel layouts and rgba8 for BMP / DIB.
- codecs/image/Miptex: Quake / GoldSrc mip textures and the WAD2 / WAD3 lump directory, read and write.
- codecs/image/Pixels: row loops between packed pixel layouts and rgba8 for BMP / DIB, and palette helpers.
- codecs/image/Quantize: palette quantization of rgba8 pixels (median cut or octree, Floyd-Steinberg dithering).
- codecs/image/Raster: an antialiased scanline rasterizer (nonzero / even-odd) for line and Bézier paths, plus a stroker.
- codecs/image/Texel: uncompressed GPU texel formats -> the standard pixel formats. New in rosetta.
@@ -245,10 +246,12 @@ 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/Brush: convex plane brushes -> polygons and Scene primitives, with Quake-family texture projection.
- 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).
- codecs/model/Minecraft: what Minecraft's voxel formats share (model/schematic, model/mca). New code.
- codecs/model/Patch: Quake III / Doom 3 Bezier patches (control grids) -> evaluated grids, triangles, normals.
- codecs/model/Polygon: 2D polygons with holes to triangles by hole bridging and ear clipping. New code.
- codecs/model/Rbx: the Roblox instance tree and property values shared by model/rbxm and model/rbxmx.
- codecs/model/Rig: the Scene mapping shared by game model formats (MD2 / MD3 / MDL / MD5 / SMD / ...). New code.
+4 -2
View File
@@ -29,13 +29,13 @@ src/Rosetta/
codecs/<domain>/<Name> codecs (layer 3) generic algorithms, by domain:
compress/ Brotli Bzip2 Deflate Explode Lz4 Lzh Lzma Lzw Lzx PackBits Quantum UnixCompress Xxh32 Zstd
entropy/ Huffman RangeCoder
image/ Bcn Blend Dct Etc Half Jpeg Pixels Quantize Raster Texel Texture Vp8 Vp8L Yuv
image/ Bcn Blend Dct Etc Half Jpeg Miptex Pixels Quantize Raster Texel Texture Vp8 Vp8L Yuv
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
font/ Bitmap Cff GlyphNames TrueType
model/ Draco Mat4 MeshFlatten Minecraft Polygon Rbx Rig Sampler Vrml
model/ Brush Draco Mat4 MeshFlatten Minecraft Patch 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` |
| plane brushes -> polygons (CSG hull, coplanar merge, Quake / Valve 220 / brush-primitive texturing); Bezier patches | `codecs/model/Brush`, `codecs/model/Patch` |
| Quake / GoldSrc mip textures, WAD2 / WAD3 directories; palettes (keyed index, grey, colormap) | `codecs/image/Miptex`, `codecs/image/Pixels` |
| 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` |