model formats (mca..x3d): comments are specs only
This commit is contained in:
1 parent
0bd7b87d2b
commit
b952c10222
49 files changed
+310
-936
No files matched your search
@@ -1,9 +1,6 @@
|
||||
--!strict
|
||||
-- model/mdl/Quake: Quake 1 MDL ("IDPO" version 6) to a Scene. Written from the Quake specs (Olivier Montanuy et
|
||||
-- al., "Quake Specs 3.4", section 5) and the modelgen.h layout of the Quake source release; no code taken.
|
||||
-- Skins (single and grouped: the first picture of a group) become texture.image through a 768-byte palette;
|
||||
-- texture coordinates on the seam of back-facing triangles move half a skin width (the vertices are welded per
|
||||
-- side); simple and grouped frames become morph targets with one animation per frame-name group.
|
||||
-- model/mdl/Quake: Quake 1 MDL ("IDPO" v6), from "Quake Specs 3.4" section 5 and modelgen.h; no code taken. Seam
|
||||
-- texture coordinates of back-facing triangles move half a skin width; a skin group shows its first picture.
|
||||
local Types = require("@rosetta/Types")
|
||||
local Pixels = require("@rosetta/codecs/image/Pixels")
|
||||
local Rig = require("@rosetta/codecs/model/Rig")
|
||||
@@ -19,7 +16,6 @@ local function name16(b: buffer, at: number): string
|
||||
return (string.match(buffer.readstring(b, at, 16), "^[^%z]*")) :: string
|
||||
end
|
||||
|
||||
-- decode(b, base, size, palette, opts) -> Scene | nil, message (offsets relative to base)
|
||||
function Quake.decode(b: buffer, base: number, size: number, palette: buffer?, opts: Options?): (Types.Scene?, string?)
|
||||
if size < 84 then
|
||||
return nil, "truncated header"
|
||||
@@ -41,7 +37,6 @@ function Quake.decode(b: buffer, base: number, size: number, palette: buffer?, o
|
||||
local function need(n: number): boolean
|
||||
return n >= 0 and p + n <= size
|
||||
end
|
||||
-- skins
|
||||
local pal = if palette then Pixels.palette(palette, 0, 256) else nil
|
||||
local skins: { Types.Image } = {}
|
||||
local px = sw * sh
|
||||
@@ -79,7 +74,6 @@ function Quake.decode(b: buffer, base: number, size: number, palette: buffer?, o
|
||||
table.insert(skins, img)
|
||||
p += count * px
|
||||
end
|
||||
-- texture coordinates and triangles
|
||||
if not need(nVerts * 12 + nTris * 16) then
|
||||
return nil, "truncated vertices / triangles"
|
||||
end
|
||||
@@ -117,7 +111,7 @@ function Quake.decode(b: buffer, base: number, size: number, palette: buffer?, o
|
||||
table.insert(indices, c[1])
|
||||
end
|
||||
p += nTris * 16
|
||||
-- frames: simple (type 0) or groups of simple frames
|
||||
-- frames: simple (type 0) or groups
|
||||
local frameAt: { number } = {}
|
||||
local names: { string } = {}
|
||||
local fsize = 24 + nVerts * 4
|
||||
|
||||
Reference in new issue
Block a user