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 -12
View File
@@ -1,8 +1,4 @@
-- model/bsp tests: Quake 1, Half-Life, Quake II and Quake III maps written by tools/fixtures/bsp.py: every model's
-- triangles per texture (positions, normals, texture coordinates against the documented rules), counter-clockwise
-- about the face normals, embedded textures (Quake through the palette, Half-Life through its own), WAD / .wal
-- textures as URIs, entities; Quake III: polygon / mesh faces against assimp's soup (of a .pk3) and the writer,
-- lightmaps, vertex colours, a tessellated patch; errors; the fuzz pass.
-- model/bsp tests: generated Quake 1 / Half-Life / Quake II / Quake III maps; Quake III faces against assimp.
local T = require("@tests/T")
local F = require("@rosetta")
local Bsp = require("@rosetta/model/bsp")
@@ -81,7 +77,6 @@ local function brush(label: string, c: any, opts: any)
return s
end
-- 1. Quake 1, Half-Life
do
local q1 = brush("q1", Fx.q1, { palette = Fx.q1.palette })
t:eq(Crc32.of(q1.textures[1].image.pixels), Fx.q1.textures[1], "q1: embedded texture through the palette")
@@ -94,7 +89,6 @@ do
t:eq(grey.meta.source.palette, false, "q1 without a palette: grey")
end
-- 2. Quake II
do
local q2 = brush("q2", Fx.q2, { files = { ["textures/brick.wal"] = Fx.q2.wal } })
t:eq(q2.textures[1].uri, "textures/brick.wal", "q2: .wal URI")
@@ -102,7 +96,6 @@ do
t:eq(q2.materials[2].extras.bsp.texels, true, "q2: texel coordinates without the .wal")
end
-- 3. Quake III
do
local q = Fx.q3
local s, err = Bsp.decode(Bytes.reader(buffer.fromstring(q.data)))
@@ -137,7 +130,6 @@ do
t:check(windingOk(prim), "q3: " .. key .. " counter-clockwise about the normals")
end
end
-- assimp: the polygon / mesh faces
local all = {}
local apos = q.assimp.pos
for _, mesh in s.meshes do
@@ -153,8 +145,7 @@ do
end
end
t:eq(q.assimp.faces, 6, "q3: assimp reads the 3 quads")
-- compare triangle sets: every assimp triangle is one of ours (up to corner rotation); assimp keeps the stored
-- clockwise order, we reverse it
-- every assimp triangle is one of ours (up to corner rotation): assimp keeps the stored clockwise order, we reverse it
local found = 0
for k = 0, #apos // 9 - 1 do
local tri = Soup.slice(apos, k * 9 + 1, 9)
@@ -198,7 +189,6 @@ do
t:check(lean ~= nil, "q3: patchLevel 1")
end
-- 4. errors, fuzz
do
local _, e1 = Bsp.decode(Bytes.reader(buffer.fromstring(string.sub(Fx.q1.data, 1, 100))))
t:check(e1 and e1.code == Err.TRUNCATED, "truncated: " .. tostring(e1))