Buffer to short when adding an indices accessor for a primitive #445
-
I've run into an issue trying to reprocess a const accessor = doc
.createAccessor()
.setBuffer(positions.getBuffer())
.setType(AccessorTypes.SCALAR)
.setArray(new Uint16Array(newIndices))
.setName('indices');
linePrimitive.setIndices(accessor); I then export the document as a I've also tried adding a new buffer but when it comes to writing the Is there something obvious I'm missing? Or is there a way to increase the size of the underlying buffer or merge two buffers before writing? Any help would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The library includes a import { weld } from '@gltf-transform/functions';
await document.transform(
weld({tolerance: 1e-4})
); If not, it might also be worth trying If none of that works, would you be able to share a sample input file? |
Beta Was this translation helpful? Give feedback.
The library includes a
weld()
function for computing indices, although I'm not sure I've tested it withLINES
primitives yet. Could you try this?If not, it might also be worth trying
io.setVertexLayout(VertexLayout.SEPARATE)
(before exporting the model) to see if that fixes whatever buffer layout issue is going on.If none of that works, would you be able to share a sample input file?