ws-3d2/fbx: model/fbx (binary 7.x + ASCII read, binary 7.4 / 7.5 + ASCII write): node tree, Objects / Connections -> Scene (full transform model, layer elements, materials, textures, skins, blend shapes, animation stacks, cameras, lights); tests against assimp + Blender, round trips, fuzz; bench lines
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
75c677074a
commit
8e2e96e198
14 files changed
+4403
No files matched your search
@@ -0,0 +1,38 @@
|
||||
-- tools/fixtures/_fbx_encode: run by tools/fixtures/fbx.py (luau CLI, repo root): decodes every FBX case with our
|
||||
-- reader and writes it back with our writer (binary 7.4, and ASCII for every third case), printing "<file>\t<hex>"
|
||||
-- lines for assimp and Blender to read back. Files: rt_<case>.fbx (binary), rt_<case>.a.fbx (ASCII).
|
||||
local Fbx = require("@formats/model/fbx")
|
||||
local Bytes = require("@formats/core/Bytes")
|
||||
local Cases = require("@tests/gen/fbx_cases")
|
||||
|
||||
local HEX = {}
|
||||
for i = 0, 255 do
|
||||
HEX[i] = string.format("%02x", i)
|
||||
end
|
||||
local function hex(b: buffer): string
|
||||
local out = table.create(buffer.len(b))
|
||||
for i = 0, buffer.len(b) - 1 do
|
||||
out[i + 1] = HEX[buffer.readu8(b, i)]
|
||||
end
|
||||
return table.concat(out)
|
||||
end
|
||||
|
||||
for i, c in Cases do
|
||||
local scene, err = Fbx.decode(Bytes.reader(buffer.fromstring(c.data)), { files = c.files, triangulate = false })
|
||||
if scene then
|
||||
local bin, e2 = Fbx.encode(scene)
|
||||
if bin then
|
||||
print(string.format("rt_%d.fbx\t%s", i, hex(bin)))
|
||||
else
|
||||
print("encode failed " .. c.name .. ": " .. tostring(e2))
|
||||
end
|
||||
if i % 3 == 0 then
|
||||
local a = Fbx.encode(scene, { ascii = true })
|
||||
if a then
|
||||
print(string.format("rt_%d.a.fbx\t%s", i, hex(a)))
|
||||
end
|
||||
end
|
||||
else
|
||||
print("skipped " .. c.name .. ": " .. tostring(err))
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user