model formats (mca..x3d): comments are specs only

This commit is contained in:
4DBug committed 2026-11-01 01:54:32 -05:00
1 parent 0bd7b87d2b
commit b952c10222
49 files changed
+310 -936

No files matched your search

+7 -15
View File
@@ -1,14 +1,7 @@
--!strict
-- model/md3: Quake III Arena MD3 models ("IDP3" version 15), read into a Scene. Written from the MD3 format
-- description in the Quake III source release (qfiles.h: md3Header_t, md3Surface_t) and the "MD3 file format"
-- notes (PhaethonH); no code taken.
-- Decode: one mesh, one primitive per surface (indices reversed to counter-clockwise; POSITION of frame opts.frame
-- (default 1) in units of 1/64; NORMAL from the stored latitude / longitude bytes; TEXCOORD_0 as stored, top-left
-- origin); every frame as a morph target of each primitive (codecs/model/Rig) and one animation "frames" over all
-- of them (opts.fps, default 15); the first shader of each surface as its material's texture URI; tags as child nodes
-- (origin + axis of frame 1; their per-frame motion as translation / rotation channels of the same animation).
-- Units are Quake units, z up. meta.source = { format, name, frames, frameNames, tags }.
-- Not supported: writing.
-- model/md3: Quake III MD3 ("IDP3" v15), from qfiles.h md3Header_t / md3Surface_t and PhaethonH's "MD3 file format";
-- no code taken. Supports: surfaces as primitives, positions in 1/64 units, lat / long normals, frames as morph
-- targets, tags as child nodes with channels. Not supported: writing.
-- ------------------------------------------------------------------------------------------------ requires
local Err = require("@rosetta/core/Err")
@@ -30,10 +23,10 @@ local Md3 = {
-- ------------------------------------------------------------------------------------------------ types
export type DecodeOptions = {
frame: number?, -- the frame used as the base POSITION / NORMAL (1-based, default 1)
morph: boolean?, -- every frame as a morph target + the animation (default true)
fps: number?, -- animation frame rate (default 15)
maxVertices: number?, -- frames x vertices over all surfaces (default 2^24)
frame: number?, -- 1-based, default 1
morph: boolean?, -- default true
fps: number?, -- default 15
maxVertices: number?, -- default 2^24
}
-- ------------------------------------------------------------------------------------------------ constants
@@ -175,7 +168,6 @@ function Md3.decode(r: Bytes.Reader, opts: DecodeOptions?): (Types.Scene?, Err.E
table.insert(mesh.primitives, prim)
so += oEnd
end
-- frames and tags
local frameNames: { string } = {}
for f = 0, nFrames - 1 do
frameNames[f + 1] = cstr(b, base + oFrames + f * 56 + 40, 16)