qmuntal / gltf

Go library for encoding glTF 2.0 files
https://www.khronos.org/gltf/
BSD 2-Clause "Simplified" License
241 stars 32 forks source link

Example how to add an image to a scene #41

Closed jeffprestes closed 2 years ago

jeffprestes commented 2 years ago

Hello!

First of all, congratulations for the project. However, I am trying to use it, add an imported image, but I am trying it and I am lost in the objects hierarchy. I've tried to read the test but they don't have an specific item for images and I could't find an example for this.

Would you mind to create and merge a simple example to import and use an image to a scene into a GLB doc?

With a basic example I guess I would be able to move forward and later I will be more than happy to send PRs with other examples.

Thanks in advance.

qmuntal commented 2 years ago

Thanks for the feedback! I'll add some examples for this use cases.

Meanwhile try using https://pkg.go.dev/github.com/qmuntal/gltf@v0.20.2/modeler#WriteImage. The gltf package requires a deep knowledge of the gltf spec to use it, and modeler is a higher level abstraction that facilitates reading and writing gltf files using go data types.

jeffprestes commented 2 years ago

Looking forward for it and to test. Meanwhile I am reading the modeler documentation.