merge ws/3d3

This commit is contained in:
4DBug committed 2026-10-31 15:39:55 -05:00
commit 47345b2c8f
96 files changed
+24729 -21

No files matched your search

+33
View File
@@ -919,6 +919,19 @@ do
bench("3mf encode", 2, buffer.len(tmf), function()
ThreeMf.encode(scene)
end)
local Wrl = require("@formats/model/vrml")
local X3d = require("@formats/model/x3d")
local wrl = assert(Wrl.encode(scene))
bench("vrml decode (" .. buffer.len(wrl) // 1000 .. " KB)", 2, buffer.len(wrl), function()
Wrl.decode(Bytes.reader(wrl))
end)
bench("vrml encode", 2, buffer.len(wrl), function()
Wrl.encode(scene)
end)
local x3d = assert(X3d.encode(scene))
bench("x3d xml decode (" .. buffer.len(x3d) // 1000 .. " KB)", 2, buffer.len(x3d), function()
X3d.decode(Bytes.reader(x3d))
end)
local V = 128
local grid = Types.Voxels.new(V, V, V)
for z = 0, V - 1 do
@@ -1125,6 +1138,26 @@ do
jitTune(false)
end
end
do
-- Draco (codecs/model/Draco): the Stanford bunny (35k points, 69k faces, Edgebreaker valence, normals) and a UV
-- sphere with seams; MB/s of decoded output (u32 indices + f32 attributes per point), plus triangles per second.
local Draco = require("@formats/codecs/model/Draco")
local DC = require("@tests/gen/draco_cases")
for _, c in DC do
if c.name == "enc/bunny_norm.obj.cl7" or c.name == "enc/uvsphere.obj.cl10" or c.name == "enc/uvsphere.obj.cl0" then
local data = buffer.fromstring(c.data)
local g = assert(Draco.decode(data))
local n = g.numFaces * 12
for _, a in g.attributes do
n += buffer.len(a.data)
end
local dt = bench("draco " .. string.sub(c.name, 5), 3, n, function()
Draco.decode(data)
end)
print(string.format("%-8s %-30s %8.0f triangles/s", runtime, " (" .. g.numFaces .. " faces)", g.numFaces / dt))
end
end
end
do
-- NBT / voxels (ws-voxel): a chunk-like NBT tree (24 sections with packed long arrays, 4000 entity-like compounds)
-- through codecs/text/Nbt (binary and SNBT), 1M packed 5-bit indices, a 64^3 Sponge schematic and Qubicle file