如何解决如何生成glTF文件,然后将其包含在链接中并使用Android Scene Viewer在AR中打开它?
我正在尝试从要构建的自定义3D glTF配置器生成glTF文件。正在生成文件,如果在link.href = URL.createObjectURL( blob );
函数中使用link.download = filename;
和save(blob)
,则可以毫无问题地下载文件。但是,我想做的是先生成glTF文件,然后将其串联在link.href
中,这样就不仅仅是下载glTF文件以便能够在Android移动设备上使用Google Scene Viewer在AR中打开它了设备。不幸的是,当我调用exportGLTF()
函数时,浏览器崩溃了!任何关于我做错事情的想法吗?
var link = document.createElement('a');
link.style.display = 'none';
function exportGLTF() {
var gltfExporter = new GLTFExporter();
gltfExporter.parse(
scene,function (result) {
var output = JSON.stringify(result,null,2);
saveString(output,'scene.gltf');
},options
);
}
function saveString(text,filename) {
save(new Blob([text],{ type: 'application/json' }),filename);
}
function save(blob) {
link.href =
'intent://arvr.google.com/scene-viewer/1.1?file=' +
URL.createObjectURL(blob) +
'&mode=ar_only#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;end';
link.click();
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。