ws-roblox: docs/guide/roblox.md (tested snippets: places, building trees, meshes) + docs_roblox inputs; F.Rbx (codecs/model/Rbx) exported by the api; bench lines (rbxm / rbxmx / robloxmesh); STYLE.md codec list gains Lz4 and Rbx
This commit is contained in:
1 parent
3a1965486f
commit
9fe5f8d658
7 files changed
+183
-3
No files matched your search
@@ -249,6 +249,40 @@ do
|
||||
Lz4.compress(raw)
|
||||
end)
|
||||
end
|
||||
-- ws-roblox: a model of 20000 parts (built here) through model/rbxm and model/rbxmx, and a .mesh decode
|
||||
do
|
||||
local Rbx = require("@formats/codecs/model/Rbx")
|
||||
local Rbxm = require("@formats/model/rbxm")
|
||||
local Rbxmx = require("@formats/model/rbxmx")
|
||||
local RobloxMesh = require("@formats/model/robloxmesh")
|
||||
local tree = Rbx.tree()
|
||||
local folder = Rbx.add(tree, Rbx.instance("Folder", "Parts"))
|
||||
for i = 1, 20000 do
|
||||
local p = Rbx.add(folder, Rbx.instance("Part", "P" .. i))
|
||||
Rbx.set(p, "CFrame", "CFrame", { i, i % 7, -i, 1, 0, 0, 0, 1, 0, 0, 0, 1 })
|
||||
Rbx.set(p, "size", "Vector3", { 4, 1, 2 + i % 3 })
|
||||
Rbx.set(p, "Color3uint8", "Color3uint8", { i % 256, 128, 255 - i % 256 })
|
||||
Rbx.set(p, "Anchored", "Bool", i % 2 == 0)
|
||||
Rbx.set(p, "Transparency", "Float32", (i % 4) / 4)
|
||||
Rbx.set(p, "Material", "Enum", 256)
|
||||
end
|
||||
local bin = Rbxm.encode(tree) :: buffer
|
||||
local xml = Rbxmx.encode(tree) :: buffer
|
||||
bench("rbxm decode (20k parts)", 3, buffer.len(bin), function()
|
||||
Rbxm.decode(Bytes.reader(bin))
|
||||
end)
|
||||
bench("rbxm encode (20k parts)", 3, buffer.len(bin), function()
|
||||
Rbxm.encode(tree)
|
||||
end)
|
||||
bench("rbxmx decode (20k parts)", 3, buffer.len(xml), function()
|
||||
Rbxmx.decode(Bytes.reader(xml))
|
||||
end)
|
||||
local M = require("@tests/gen/robloxmesh")
|
||||
local mesh = buffer.fromstring(M.cases[#M.cases - 1].data)
|
||||
bench("robloxmesh decode (v7, skinned)", 20, buffer.len(mesh), function()
|
||||
RobloxMesh.decode(Bytes.reader(mesh))
|
||||
end)
|
||||
end
|
||||
do
|
||||
local Brotli = require("@formats/codecs/compress/Brotli")
|
||||
local BB = require("@tests/gen/brotli_bench")
|
||||
|
||||
Reference in new issue
Block a user