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

+3 -10
View File
@@ -1,5 +1,4 @@
-- tests/model/_soup: helpers for the game model tests: a primitive's triangle soup (positions, morph target frames,
-- texture coordinates in index order) and a tolerant comparison against assimp's soup.
-- tests/model/_soup: triangle soups of a primitive and a tolerant comparison against assimp's soup.
local Types = require("@rosetta/Types")
local Soup = {}
@@ -20,8 +19,7 @@ function Soup.positions(prim: any, target: number?): buffer
return out
end
-- uvs(prim, set?, flip?) -> { u, v, ... } of the corners in index order (flip: v -> 1 - v, assimp's convention;
-- "neg": v -> -v, assimp's Half-Life loader)
-- flip: v -> 1 - v (assimp's convention); "neg": v -> -v (assimp's Half-Life loader)
function Soup.uvs(prim: any, set: number?, flip: (boolean | string)?): { number }
local tc = Types.Scene.reader(prim.attributes["TEXCOORD_" .. (set or 0)]) :: any
local idx = prim.indices
@@ -34,7 +32,6 @@ function Soup.uvs(prim: any, set: number?, flip: (boolean | string)?): { number
return out
end
-- close(a: buffer f32 | {number}, b: {number}, tol) -> true | false, first index that differs
function Soup.close(a: any, b: { number }, tol: number): (boolean, number?)
local n = if type(a) == "buffer" then buffer.len(a) // 4 else #a
if n ~= #b then
@@ -49,9 +46,7 @@ function Soup.close(a: any, b: { number }, tol: number): (boolean, number?)
return true, nil
end
-- triangles(a, b, tol, stride?) -> true when the triangle lists a and b (flat numbers, stride per corner: 3 for
-- positions, 2 for texture coordinates) hold the same triangles in the same order, each up to a cyclic rotation of
-- its corners (assimp rotates them); false, the first differing triangle otherwise
-- triangles compare up to a cyclic rotation of their corners (assimp rotates them)
function Soup.triangles(a: { number }, b: { number }, tol: number, stride: number?): (boolean, number?)
local s = stride or 3
if #a ~= #b then
@@ -82,7 +77,6 @@ function Soup.triangles(a: { number }, b: { number }, tol: number, stride: numbe
return true, nil
end
-- list(buf) -> the f32 values of a buffer as numbers
function Soup.list(b: buffer): { number }
local out = table.create(buffer.len(b) // 4)
for i = 0, buffer.len(b) // 4 - 1 do
@@ -91,7 +85,6 @@ function Soup.list(b: buffer): { number }
return out
end
-- slice(list, from, n) -> n values from index from (1-based)
function Soup.slice(list: { number }, from: number, n: number): { number }
return table.move(list, from, from + n - 1, 1, table.create(n))
end