ws-3d3: codecs/model/Draco: kd-tree point clouds (bitstream 2.3, levels 0 - 6)
Byte-exact against libdraco on all 206 test files, kd-tree point clouds included.
This commit is contained in:
1 parent
de2695b87d
commit
4f2a388a6d
4 files changed
+388
-19
No files matched your search
@@ -3,11 +3,12 @@
|
||||
-- A codec, not a format: model/gltf (and any format carrying Draco data) calls it on a byte range.
|
||||
-- Ported from Google's Draco 1.5.7 (Apache-2.0, licenses/draco-LICENSE.txt): the decoder only, bitstream versions
|
||||
-- 1.0 - 2.2 for meshes (sequential and Edgebreaker connectivity: standard, predictive and valence traversals; topology
|
||||
-- splits, attribute seams) and sequential point clouds; attribute decoders generic / integer / quantization /
|
||||
-- octahedral normals; prediction schemes difference, parallelogram, multi-parallelogram, constrained
|
||||
-- multi-parallelogram, tex coords (deprecated and portable), geometric normal, with the wrap and normal octahedron
|
||||
-- transforms; metadata. Values match draco_decoder bit for bit (f32 rounding at every step of the dequantization).
|
||||
-- Not supported: kd-tree point clouds (Err.UNSUPPORTED).
|
||||
-- splits, attribute seams), sequential point clouds and kd-tree point clouds (2.3); attribute decoders generic /
|
||||
-- integer / quantization / octahedral normals; prediction schemes difference, parallelogram, multi-parallelogram,
|
||||
-- constrained multi-parallelogram, tex coords (deprecated and portable), geometric normal, with the wrap and normal
|
||||
-- octahedron transforms; metadata. Values match draco_decoder bit for bit (f32 rounding at every step of the
|
||||
-- dequantization).
|
||||
-- Not supported: the pre-2.3 kd-tree point cloud layouts (Err.UNSUPPORTED).
|
||||
--
|
||||
-- local Draco = require("@formats/codecs/model/Draco")
|
||||
-- local g, err = Draco.decode(buf, off?, len?, opts?) -- buffer | string
|
||||
@@ -262,12 +263,10 @@ local function decode(buf: buffer, o: number, l: number, opts: any): (Geometry?,
|
||||
end
|
||||
numPoints = m.numPoints
|
||||
else
|
||||
if h.method == 1 then
|
||||
return nil, "unsupported: kd-tree point clouds", nil
|
||||
elseif h.method ~= 0 then
|
||||
if h.method > 1 then
|
||||
return nil, "unsupported: point cloud encoding method " .. h.method, nil
|
||||
end
|
||||
method = "sequential"
|
||||
method = if h.method == 1 then "kdtree" else "sequential"
|
||||
numPoints = Reader.i32(d)
|
||||
if d.bad then
|
||||
return nil, d.bad, nil
|
||||
@@ -279,7 +278,7 @@ local function decode(buf: buffer, o: number, l: number, opts: any): (Geometry?,
|
||||
if numPoints > maxPoints then
|
||||
return nil, "too many points", "limit"
|
||||
end
|
||||
local attrs, aerr = Attributes.decode(d, { numPoints = numPoints, mesh = mesh, edgebreaker = method == "edgebreaker", kdTree = false })
|
||||
local attrs, aerr = Attributes.decode(d, { numPoints = numPoints, mesh = mesh, edgebreaker = method == "edgebreaker", kdTree = method == "kdtree" })
|
||||
if not attrs then
|
||||
return nil, aerr, nil
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user