three.js icon indicating copy to clipboard operation
three.js copied to clipboard

GLTFLoader: Avoid unnecessary ArrayBuffer copies.

Open donmccurdy opened this issue 5 years ago • 2 comments

Need to test this a bit more, but it should ensure that reading the glTF binary buffer happens in place.

donmccurdy avatar Jun 10 '20 16:06 donmccurdy

Awesome change!

Are there any plans to allow for passing in a DataView or Uint8Array with a byte offset into parse? Some formats like B3DM are wrapping GLTF so you might want to pass a buffer with an offset in to be parsed. Definitely a bigger change but seemed related and would help save some memory in those cases. But maybe there are other reasons not to do this.

gkjohnson avatar Jun 10 '20 21:06 gkjohnson

Are there any plans to allow for passing in a DataView or Uint8Array with a byte offset into parse?

No plans, but it sounds like a good idea to me! Should be easy enough to support both, check if the object has a .byteOffset, and convert it to something consistent (DataView?) passed through the rest of the parse process.

donmccurdy avatar Jun 10 '20 21:06 donmccurdy