CesiumGS / gltf-pipeline

Content pipeline tools for optimizing glTF assets. :globe_with_meridians:
Apache License 2.0
1.87k stars 241 forks source link

Hope to support compressing GLTF files with image URIs as HTTP addresses into GLB format #649

Open terrykingcha opened 8 months ago

terrykingcha commented 8 months ago

As mentioned in my title, in our GLTF, the textures are accessed independently on the CDN. Our 3D engine also supports reading separate image CDN addresses in GLTF/GLB. I hope this tool can support this situation.

Of course, before making this request, I also carefully read the code. The modifications I tried myself may involve four areas.

  1. In .writeResource.js - lines 53 to 55, skip the processing of ForEach.image when supported parameters are active.
  2. In readResource.js - the readResource method, add a check for the 'http(s)' protocol before the final return, and directly return the URI.
  3. In readResource.js - lines 54 to 56, skip the processing of ForEach.image when supported parameters are active.
  4. In FileUrl.js - the fileURLToPath method, add a check for the 'http(s)' protocol between the two conditions, and directly return the path.

Based on the modifications mentioned above, I have successfully run them on my local code. However, a more comprehensive design would ideally be advanced by the official team. Thank you.

Attached is the screenshot of the part of the code I modified.

screenshot-20231115-222529 screenshot-20231115-222715 screenshot-20231115-222645 screenshot-20231115-222616