Closed zbml closed 2 years ago
When you write a non-binary glTF the buffers shall either be embedded, i.e. calling doc.Buffers[0].EmbeddedResource()
, or have a valid URI, e.g. setting doc.Buffers[0].URI = "./foo.bin"
. If those invariants are not met, then gltf.Save
returns an error as it doesn't know in which file to store each buffer.
This limitation does no apply to the first buffer of a GLB file because -following the glTF spec- it is written into the same GLB file unless it is embedded or has a URI.
@qmuntal thanks. That's what I need.
I got this code from here and use this code for learning how to use this package.
When I save this doc as a glb, it works fine. But not for saving as a gltf. When use saving as gltf code, I got "panic: gltf: Invalid buffer.uri value '' .
So I am wondering do I have to set a buffer for the document when save as gltf?
If I do, then why glb was ok?