tests/model: comments: specs only
This commit is contained in:
1 parent
5f7f6005f6
commit
fe7566cbba
37 files changed
+72
-440
No files matched your search
+2
-15
@@ -1,9 +1,5 @@
|
||||
-- model/ms3d tests: assimp's MilkShape 3D test models (groups, materials, textures, version 4 with and without the
|
||||
-- sub-versioned blocks) against assimp (meshes, faces, corners, materials, world bounds); round trips through our
|
||||
-- writer, of those files and of glTF sample models (world triangles, materials, textures, skins: joints, inverse bind
|
||||
-- matrices, skinned vertices; animation sampled through the skeleton); assimp reading our files (meshes, faces,
|
||||
-- bones, animations, bounds: ms3d_xcheck); comments and extras; errors; the fuzz no-throw pass. Fixtures:
|
||||
-- tools/fixtures/ms3d.py.
|
||||
-- model/ms3d tests: assimp's MilkShape 3D models against assimp; round trips; assimp reading ours.
|
||||
-- Fixtures: tools/fixtures/ms3d.py.
|
||||
local T = require("@tests/T")
|
||||
local F = require("@rosetta")
|
||||
local Ms3d = require("@rosetta/model/ms3d")
|
||||
@@ -84,7 +80,6 @@ local function bones(scene: any): number
|
||||
return n
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ reference files
|
||||
local scenes = {}
|
||||
for i, c in Cases do
|
||||
local scene, err = decode(c.data)
|
||||
@@ -107,8 +102,6 @@ for i, c in Cases do
|
||||
end
|
||||
t:note("%d files against assimp", #Cases)
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ round trips
|
||||
-- skinned world positions at a time: the skeleton posed by animations[1], vertices blended by their joints
|
||||
local function skinnedPositions(s: any, time: number): { number }
|
||||
local byNode: { [number]: { [string]: any } } = {}
|
||||
for _, ch in (if s.animations[1] then s.animations[1].channels else {}) :: { any } do
|
||||
@@ -250,7 +243,6 @@ local function compare(a: any, b: any, label: string, eps: number)
|
||||
if a.skins[1] then
|
||||
t:eq(#b.skins[1].joints, #a.skins[1].joints, label .. ": joints")
|
||||
end
|
||||
-- the same posed triangles (the corners in order) at a few times
|
||||
for _, time in { 0, 0.3, 0.75, 1.2, 2.5, 4 } do
|
||||
local pa, pb = skinnedPositions(a, time), skinnedPositions(b, time)
|
||||
local ok = #pa == #pb
|
||||
@@ -315,7 +307,6 @@ for gi, g in Picks do
|
||||
end
|
||||
t:note("%d reference files and %d glTF models through our writer and back", #Cases, ng)
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ cross-check
|
||||
local nx = 0
|
||||
for _, x in Xcheck do
|
||||
local a = x.assimp
|
||||
@@ -339,7 +330,6 @@ for _, x in Xcheck do
|
||||
end
|
||||
t:note("%d of our files read back by assimp", nx)
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ details
|
||||
do
|
||||
local byName = {}
|
||||
for i, c in Cases do
|
||||
@@ -359,7 +349,6 @@ do
|
||||
t:eq(mats.meta.source.vertexVersion, 3, "vertex extras subversion 3")
|
||||
t:check(mats.materials[2].extras.ms3d.shininess > 0, "shininess in extras")
|
||||
end
|
||||
-- a skinned scene by hand: two joints, comments, weights split between them
|
||||
local gl = gltfScenes[3]
|
||||
if gl then
|
||||
local out = Ms3d.encode(gl) :: buffer
|
||||
@@ -388,7 +377,6 @@ do
|
||||
t:check(viaApi and buffer.readstring(viaApi, 0, 10) == "MS3D000000", "F.save format ms3d")
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ errors
|
||||
do
|
||||
local data = Cases[2].data
|
||||
local _, e1 = decode(string.sub(data, 1, 100))
|
||||
@@ -404,7 +392,6 @@ do
|
||||
t:eq(Ms3d.sniff(Bytes.reader(buffer.fromstring(data))), 1, "sniff")
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ fuzz
|
||||
do
|
||||
local samples = {}
|
||||
for _, c in Cases do
|
||||
|
||||
Reference in new issue
Block a user