Add support for type 4 decoding

This commit is contained in:
D. Berge
2025-08-21 14:55:53 +02:00
parent 57a73f7d1c
commit 767c2f2cb1

View File

@@ -84,8 +84,12 @@ const DougalBinaryLoader = {
for (let k = 0; k < values.length; k++) { for (let k = 0; k < values.length; k++) {
values[k] = new (k === 0 ? Uint16Array : k === 1 ? Uint32Array : k === 2 ? BigUint64Array : Float32Array)(totalCount); values[k] = new (k === 0 ? Uint16Array : k === 1 ? Uint32Array : k === 2 ? BigUint64Array : Float32Array)(totalCount);
} }
} else if (udv == 4) {
for (let k = 0; k < values.length; k++) {
values[k] = new (k === 0 ? Uint16Array : k === 1 ? Uint32Array : k === 2 ? Uint16Array : Float32Array)(totalCount);
}
} else { } else {
throw new Error(`Invalid udv: Expected 0, 1, or 2; found ${udv}`); throw new Error(`Invalid udv: Expected 0, 1, 2, or 4; found ${udv}`);
} }
let offset = 0; let offset = 0;
@@ -110,7 +114,7 @@ const DougalBinaryLoader = {
offset += chunk.jCount; offset += chunk.jCount;
} }
console.log(`Parsed ${totalCount} points, ${values.length} value arrays`); console.log(`Parsed ${totalCount} points, ${values.length} value arrays, udv = ${udv}`);
const attributes = { const attributes = {
getPosition: { getPosition: {