tests/model: comments: specs only

This commit is contained in:
4DBug committed 2026-11-01 01:50:23 -05:00
1 parent 5f7f6005f6
commit fe7566cbba
37 files changed
+72 -440

No files matched your search

+2 -10
View File
@@ -1,8 +1,5 @@
-- model/b3d tests: assimp's Blitz3D models (WusonBlitz, dwarf2, turtle1) and generated files (textures, brushes,
-- vertex colours, two UV sets, nested rotated / scaled / mirrored nodes, pivots, master brushes, bones, keys + ANIM)
-- against assimp (meshes, faces, materials, animations, channels, bones; world bounds, triangle area and signed
-- volume from its PreTransformVertices export: the left- to right-handed conversion and the winding) and the counts
-- the generator wrote; the skin's bind pose; error codes; the fuzz no-throw pass. Fixtures: tools/fixtures/b3d.py.
-- model/b3d tests: assimp's Blitz3D models and generated files against assimp (PreTransformVertices export).
-- Fixtures: tools/fixtures/b3d.py.
local T = require("@tests/T")
local B3d = require("@rosetta/model/b3d")
local MeshOps = require("@rosetta/ops/MeshOps")
@@ -28,7 +25,6 @@ local function near(a: number, b: number, eps: number): boolean
return math.abs(a - b) <= eps * math.max(1, math.abs(a), math.abs(b))
end
-- world triangles of the merged scene: area and signed volume
local function measure(prim: any): (number, number)
local get = assert(Types.Scene.reader(prim.attributes.POSITION))
local idx = prim.indices and Types.Scene.reader(prim.indices)
@@ -76,7 +72,6 @@ local function boneCount(scene: any): number
return n
end
-- ------------------------------------------------------------------------------------------------ cases
local samples = {}
for _, c in Cases do
local scene, err = decode(c.data, { files = c.files })
@@ -119,7 +114,6 @@ for _, c in Cases do
if not (c.want and c.want.mirrored) then
t:check(near(vol, a.volume, 1e-3), string.format("%s: signed volume %.6g (assimp %.6g)", c.name, vol, a.volume))
end
-- textures resolved through files
for _, tex in scene.textures do
local base = string.match(tex.uri, "([^/\\]+)$")
t:check((tex.data ~= nil) == (c.files[base] ~= nil), c.name .. ": texture data " .. tostring(tex.uri))
@@ -203,7 +197,6 @@ for _, c in Cases do
end
end
-- ------------------------------------------------------------------------------------------------ errors
do
local _, e = decode("BB3D\4\0\0\0\1\0\0\0")
t:check(e and e.code == Err.CORRUPT, "no NODE: CORRUPT")
@@ -218,7 +211,6 @@ do
t:check(e3 and e3.code == Err.LIMIT, "maxVertices: LIMIT")
end
-- ------------------------------------------------------------------------------------------------ fuzz
t:fuzz("decode", function(b: buffer)
local s = B3d.decode(Bytes.reader(b))
if s then