import: OBJ review fixes -- an inline # comment on a face line read as a vertex ref, a CR-only file's \ continuation wasn't joined, a big file split into millions of line strings (now one scan into growable typed arrays; a file past the string limit says so), and a 3MF's import note outlived the OBJ after it on a language switch

This commit is contained in:
matthewtrahan authored and Matthew Trahan committed 2026-10-16 10:00:56 -05:00
1 parent 6582065595
commit e700218b31
3 files changed
+42 -13

No files matched your search

+6
View File
@@ -86,3 +86,9 @@ Deno.test('obj: no faces, a dangling reference or a bad vertex fail loudly', ()
throws(() => readOBJ(enc('v 0 0 0\nf -2 -1 1\n')), /isn't there/, 'relative ref before the start');
throws(() => readOBJ(enc('v 0 zero 0\n')), /bad vertex/, 'bad number');
});
Deno.test('obj: inline comments, CR-only lines and `\\` continuations read', () => {
const text = 'v 0 0 0 # origin\rv 1 0 \\\r0\rv 0 1 0\rf 1 2 3 # one triangle\r';
const p = readOBJ(enc(text)).objects[0].positions;
assert([...p].join() === '0,0,0,1,0,0,0,1,0', `${[...p]}`);
});