【问题标题】:How can I get the .data3d.buffer from my uploaded 3d model through storage API如何通过存储 API 从上传的 3d 模型中获取 .data3d.buffer
【发布时间】:2017-09-28 02:17:05
【问题描述】:

我可以通过 storage api 上传我的 3d 模型。但我无法从存储 api 获取 .data3d.buffer。我发现 .data3d.buffer 是 aframe 加载 3d 模型所必需的。如何通过 storage api 获取 .data3d.buffer??

【问题讨论】:

    标签: archilogic 3d.io


    【解决方案1】:

    如果你有存储密钥,可以直接从storage.3d.io下载模型。

    例子:

    io3d.storage.put(myFile).then(function (storageKey) {
      console.log('the data3d.buffer is now at', 'https://storage.3d.io' + storageKey)
    })
    

    请注意,该文件将有一个.gz.data3d.buffer,因为浏览器将在下载时解压缩打包的资产。您可能必须删除 .gz 才能直接使用该文件。

    Storage API 可以直接使用,但会自动为你解析二进制文件为 JSON。

    要在 A-Frame 中使用模型,您只需要存储密钥(在浏览器中):

    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)
    })
    

    【讨论】:

      猜你喜欢
      • 2018-03-13
      • 2015-04-11
      • 1970-01-01
      • 1970-01-01
      • 2013-12-14
      • 1970-01-01
      • 2019-05-03
      • 2020-06-26
      • 1970-01-01
      相关资源
      最近更新 更多