简体   繁体   English

来自three.js的gltf加载器是否与ie11不兼容?

[英]Is the gltf loader from three.js incompatible with ie11?

I have been trying to load gltf in three.js scenes using the loader but it doesn't work on ie11 whereas it is said that it does on their web site . 我一直在尝试使用加载器在three.js场景中加载gltf,但它不适用于ie11,而据说它在他们的网站上运行 Also, the gltf loader examples don't work either (on internet explorer). 此外, gltf加载器示例也不起作用 (在Internet Explorer上)。 Can anybody confirm that this is the case and, if so, please update the information about the browser compatibility of the loader? 任何人都可以确认是这种情况,如果是这样,请更新有关加载程序的浏览器兼容性的信息吗?

EDIT: I have already tried using ES6 Promises polyfill as in my example in this question I posted a month ago. 编辑:我已经尝试过使用ES6 Promises polyfill,就像我在一个月前发布的这个问题中的例子一样。

GLTFLoader is compatible with IE11, but requires that you "polyfill" certain features that are missing in IE11. GLTFLoader与IE11兼容,但要求您“填充”IE11中缺少的某些功能。 In practice, that means you must include a script that adds the Promise feature, which IE11 does not have by default. 实际上,这意味着您必须包含一个添加Promise功能的脚本,IE11默认情况下没有这个功能。

If that isn't working, I would suggest filing an issue on the three.js github issues, it may be a bug. 如果这不起作用,我建议就three.js github问题提出问题,这可能是一个错误。

According to three.js docs, GLTFLoader: Browser compatibility : 根据three.js文档,GLTFLoader:浏览器兼容性

GLTFLoader relies on ES6 Promises, which are not supported in IE11.
To use the loader in IE11, you must include a polyfill providing a Promise replacement.

gltf loader is incompatible with IE11, but it's possible to to make it work with IE11 with polyfills for ES6 promises. gltf加载程序与IE11不兼容,但是它可以使用IE11与polyfill一起使用ES6承诺。

if your page doesn't show the gltf models after import ES6 polyfill,you may need to do this: 如果您的页面在导入ES6 polyfill后没有显示gltf模型,您可能需要这样做:

change the parse function in GLTFLoader.js 更改GLTFLoader.js中解析函数

var json = JSON.parse(content)

to

var json = eval('('+content+')')

it works for me. 这个对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM