I can upload my 3d model through storage api. But I can not get the .data3d.buffer from storage api. I found the .data3d.buffer is necessary for aframe to load the 3d model. How can I get the .data3d.buffer through storage api??
If you have the storage key, you can directly download the model from storage.3d.io
.
Example:
io3d.storage.put(myFile).then(function (storageKey) {
console.log('the data3d.buffer is now at', 'https://storage.3d.io' + storageKey)
})
Note that the file will have a .gz.data3d.buffer
as the browser is going to decompress the packed asset when downloading. You may have to remove the .gz
to be able to use the file directly.
The Storage API can be used directly, but will automatically parse the binary file into JSON for you.
To use the model in A-Frame you would only need the storage key anyway (in the browser):
io3d.storage.put(myFile).then(function (storageKey) {
var model = document.createElement('a-entity')
model.setAttribute('io3d-data3d', 'key: ' + storageKey)
document.querySelector('a-scene').appendChild(model)
})