Closed electro-logic closed 2 years ago
There's already a method to write a GLB to a a stream.
Notice there's no counterpart for glTF because an open glTF file writes multiple files, and those cannot be written to a single stream.
For advanced scenarios, you can check the example that writes glTFs to a ZIP file (which is a stream)
Thanks a lot for the quick reply, I missed that because of the different name.
Why not moving (or adding) it to an overload of the SaveGLB method? Would be an easier API.
Thanks again
It's a personal naming convention. I use Load/Save
for system files, and Read/Write
for streams, arrays, and essentially anything that is not a file.
Make sense, thanks again
Hello,
Would be very handy to have some additional overloads for SaveGLB() and SaveGLTF() that accept a Stream as input, to enable additional scenarios. In UWP for example you need to request a permission to get a workable Stream for files and without these override only the LocalApp path is easily usable.
As a temporary workaround I'm using this code
var context = WriteContext.CreateFromStream(stream).WithBinarySettings().WithSettingsFrom(null); context.WriteBinarySchema2("model", model);
to "emulate" a model.SaveGLB(stream)
Thank you, Leonardo