archilogic-com / aframe-gblock

Aframe component loading models from poly.google.com (inofficial)
MIT License
68 stars 14 forks source link

fix current demo by using official google poly API to get GLTF model url #7

Closed antoniohof closed 6 years ago

antoniohof commented 6 years ago

Demo was not working. Fixed by using official google poly API. Now it's necessary to setup your API_KEY

tomas-polach commented 6 years ago

Thx! This is really welcome!

I checked and it's luckily only the download domain that changed from https://poly.google.com/downloads/* to https://poly.googleusercontent.com/downloads/*. It's still working without API key after fixing this: https://github.com/archilogic-com/aframe-gblock/commit/356b922c9caf8e2339952684f731f8a6d330c1f5

If you don't mind: I will merge your code in such a way that the user can decide whether he prefers the official API using the API key (recommended) or the unofficial way without API key (for backward compatibility, keeping old implementations working). Would you be OK with that?

antoniohof commented 6 years ago

Sure! No problem :)

antoniohof commented 6 years ago

I just realized it's not working with GLTF2 models, change line 100 to var format = info.formats.find( format => { return format.formatType === 'GLTF' || format.formatType === 'GLTF2'; } ); to fix it.

tomas-polach commented 6 years ago

wondering how to extend the current a-frame component while keeping backward compatibility. what do you think about:

Basic Example

Using a Google Poly API key: (Recommended)

<a-entity gblock="https://poly.google.com/objects/dVG0XJrpRJC?key=xxxxxxxxxxxx"></a-entity>

Using unofficial API without key: (Legacy mode: Might be discontinued in the future.)

<a-entity gblock="https://poly.google.com/objects/dVG0XJrpRJC"></a-entity>