Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*Enhancement* Add ability for GLTF loader to load embeded dataURLs #5619

Open
SugarRayLua opened this issue Dec 31, 2024 · 0 comments
Open

Comments

@SugarRayLua
Copy link

Description:
I'm a non-professional novice 3D WebGL programmer and recently started using A-Frame and like it very much! It's very easy to just add the CDNs for A-Frame, put together some ideas with 3D models, and then use A-Frames simple framework to build my scenes. With how easy A-Frame is to use, I was hoping then just to embed the framework and the models inside a single-file .html and share them with my friends and family to try out by sending them a link to download the single-file .html from my Dropbox or other storage. I'm currently able to do so for .obj models without external textures (i.e. that contain only .obj and .mtl files) through A-Frame's .obj loader by inlining the js A-Frame framework code then using dataURLs to paste in the .obj and .mtl files as sources. However, the obj loader doesn't have a mechanism to upload any textures for me to embed for more complex .obj 3D models, and it didn't seem that the GLTF model loader is able to handle either .gltf(embedded) or base64 encrypted .glb dataURLs as a source to do the same. Thus, I'm not able to easily share my projects with my friends and family who may use different computer systems then I do or have different operating systems than i use (the advantage of distributing cross-platform programs as .html/js/embedded data in dataURLs).

I would prefer not to set up and host my own server or publish all of my creations to a commercial hosting site just to be able to share A-Frame creations with my friends and family. If the GLTF loader could load embedded dataURLs, I could just embed my creations in a single-file .html, send my friends and family a link to download the file, and they could then decide to download the file and open it in their browser, review its contents with a text editor, or discard the file when they are done.

Thank you for considering this as a future enhancement.

  • A-Frame Version: 1.6
  • Platform / Device: Linux/AMD x86-64
  • Reproducible Code Snippet or URL: (Unfortunately, reproducible snippets of embedded dataURLs are too large to paste into this issue box). I've followed the dataURL syntax when pasting in dataURL data as follows:

For the .obj model loader:

<a-asset-item id="EgyptObj" src="data:,ABCD... [sample .obj file embedded data]">
</a-asset-item>
<a-asset-item id= "EgyptMtl" src="data:,ABCD... [sample .mtl file embedded data]">
</a-asset-item>

<a-obj-model src= "#EgyptObj" mtl="#EgyptMtl">
</a-obj-model>

The above works (but as I mentioned, there isn't a way to load texture files specified from the .mtl file).

<a-asset-item id="EgyptGLTF" src="data:,ABCD... [sample .gltf (embedded) txt file data]">
or
<a-asset-item id="EgyptGLB" src="data:application/octet-stream;base64,ABCD.. [sample base64 encoded .glb file data]">

<a-gltf-model src="#EgyptGLTF" [or #EgyptGLB]">
</a-gltf-model>

doesn't seem to work (neither a .gltf nor a .glb model get loaded into the scene)

Attached are some quick projects I put together that I would love to be able to package as a single file .html to send to friends (and to store on my phone/mobile devices to use). :-)

Egypt
Haunted
Pirate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant