ws-3d2/dae: model/dae (Collada 1.4/1.5 + .zae) read: geometry (all primitive kinds, shared offsets), common-profile materials + images, node tree (all transform elements, instance_node), skin + morph controllers, cameras, lights, animations resampled to TRS channels (clips); write: Collada 1.4.1 / .zae (meshes, materials, images, nodes, cameras, lights). Tests against assimp's Collada models (nixpkgs assimp.src at fixture time), assimp exports of glTF samples vs their originals, assimp reading our output, round trips, fuzz
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
75c677074a
commit
a7b4a69177
9 files changed
+3385
No files matched your search
@@ -0,0 +1,36 @@
|
||||
-- tools/fixtures/_dae_encode: run by tools/fixtures/dae.py (luau CLI, repo root): decodes every Collada case with our
|
||||
-- reader and encodes it with our writer (rt_<case>.dae + its image files, and rt_<case>.zae for the first cases),
|
||||
-- printing "<file>\t<hex>" lines for assimp to read back.
|
||||
local Dae = require("@formats/model/dae")
|
||||
local Bytes = require("@formats/core/Bytes")
|
||||
local Cases = require("@tests/gen/dae_cases")
|
||||
|
||||
local HEX = {}
|
||||
for i = 0, 255 do
|
||||
HEX[i] = string.format("%02x", i)
|
||||
end
|
||||
local function hex(s: string): string
|
||||
local out = table.create(#s)
|
||||
for i = 1, #s do
|
||||
out[i] = HEX[string.byte(s, i)]
|
||||
end
|
||||
return table.concat(out)
|
||||
end
|
||||
|
||||
for i, c in Cases do
|
||||
local scene, err = Dae.decode(Bytes.reader(buffer.fromstring(c.data)), { files = c.files })
|
||||
if scene then
|
||||
local files = {}
|
||||
local dae = assert(Dae.encode(scene, { files = files, name = "rt_" .. i .. ".dae" }))
|
||||
print(string.format("rt_%d.dae\t%s", i, hex(buffer.tostring(dae))))
|
||||
for name, data in files do
|
||||
print(name .. "\t" .. hex(if type(data) == "string" then data else buffer.tostring(data)))
|
||||
end
|
||||
if i <= 3 then
|
||||
local zae = assert(Dae.encode(scene, { format = "zae" }))
|
||||
print(string.format("rt_%d.zae\t%s", i, hex(buffer.tostring(zae))))
|
||||
end
|
||||
else
|
||||
print("skipped " .. c.name .. ": " .. tostring(err))
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user