ws-game: model/smd (Valve SMD read + write: skeleton, skin, weights links, frames as animation, animation SMDs); Rig.influences merges a joint listed twice

This commit is contained in:
4DBug committed 2026-10-31 14:47:06 -05:00
1 parent f14d5ac4ef
commit 08045ba813
9 files changed
+938 -2

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
-- tools/fixtures/_smd_encode.luau: run by tools/fixtures/smd.py under the luau CLI: decodes the reference SMDs of
-- tests/gen/smd_src and writes them back with our encoder (bind pose; links; and the animation as an animation SMD),
-- printing "<name>\t<hex>" lines for assimp to read back.
local Smd = require("@formats/model/smd")
local Bytes = require("@formats/core/Bytes")
local Src = require("@tests/gen/smd_src")
local function hex(b: buffer): string
return (string.gsub(buffer.tostring(b), ".", function(c: string): string
return string.format("%02x", string.byte(c))
end))
end
for _, c in Src do
local s = Smd.decode(Bytes.reader(buffer.fromstring(c.data)))
if s then
print(c.name .. "\t" .. hex(Smd.encode(s) :: buffer))
if #s.animations > 0 then
print(c.name .. "-anim\t" .. hex(Smd.encode(s, { animation = 1 }) :: buffer))
end
end
end