tetra3d icon indicating copy to clipboard operation
tetra3d copied to clipboard

feature request: add `Load[DAE/GLTF]FromReader(io.Reader)`

Open btvoidx opened this issue 1 year ago • 3 comments

Right now one has to io.ReadAll before passing the data slice into LoadGLTFData which wraps it in a reader, so why not pass a reader directly? Loading from file is not ideal, since assets may be embedded via //go:embed into an embed.FS (my case!), which also brings up a point of adding Load[DAE/GLTF]FromFS.

Looking at LoadDAEData, I assume it could also use a xml.NewDecoder, but if there is some arcane reasoning behind umarshaling it three times separately from a byte slice, it could just io.ReadAll to get it from the provided reader.

btvoidx avatar Jan 11 '24 20:01 btvoidx

Sorry about that, I missed this issue.

OK, I see what you mean, that does make sense and seems like it would be simpler. I'll see about updating the functions to just take an io.Reader instead of a byte slice.

I haven't really returned to the DAE loader since I implemented the GLTF loader, to be honest - what you mention is one way that it could be simplified and cleaned up.

SolarLune avatar Feb 02 '24 01:02 SolarLune

I added a commit (bb729df157fe3a120290a1d2abf914267c7d7caf) that should resolve this for GLTF - I'm not sure about DAE because I kind of feel like just deprecating DAE entirely and moving away from it.

I'm kind of ambivalent on supporting it, considering I don't use it, the Tetra3D add-on doesn't use it, and I generally wouldn't recommend anyone else to, either.

SolarLune avatar Feb 06 '24 04:02 SolarLune

I don't think anyone uses DAE. Quick code search across GitHub revealed just one public instance of it being used not in Tetra3D fork.

If you decide to deprecate it then the issue can be closed - v0.15.0 is out and DAE part won't be done.

btvoidx avatar Feb 06 '24 12:02 btvoidx