1

基本上我正在下载一个 zip 文件并提取一个 collada 文件以加载到浏览器中。这在 chrome 中非常棒,但在 Firefox 中通过鼠标移动模型时真的很慢。我似乎无法弄清楚这一点,或者我是否缺少加快 Firefox 或其他什么的设置。文件在这里加载

http://moneybagsnetwork.com/3d/test.htm

它使用 jsunzip 和 three.js 来加载所有内容。我绕过了 jsunzip,这不是问题。我还简化了模型,不使用任何事件侦听器,也没有灯光,这没有一点帮助。完全被这里难住了,模型真的没那么大:/

这是我正在使用的文件的 zip 链接

http://moneybagsnetwork.com/3d/good.zip

对多条评论行感到抱歉。如果这个问题得到解决,我可能会重新启动。

4

2 回答 2

3

I have noticed that Chrome is usually way faster and more responsive with Three.js applications than Firefox. The difference is not so much on the WebGL side, but at the plain Javascript supporting code.

Looking at your code, it seems you do some very heavy javascript stuff on your onmousemove function. This could very well cause much of the performance gap between the browsers. Mousemove is executed many many times during each and every mousemovement, so it quickly adds up to slow performance. It could also be that Firefox actually creates more mousemove events for similat cursor movements (not sure).

You could either move most of the raycasting and other stuff from mousemove to mouseclick. Alternatively, you could implement a delayed mousemove so that the function is called only maximum of X times per second, or only when the mouse has stopped. Something like this (untested but should work):

var mousemovetimer = null; 

function onmousemove(event){     
  if (mousemovetimer) {
    window.clearTimeout(mousemovetimer);
  }
  mousemovetimer = window.setTimeout(delayedmousemove, 100);
}
function delayedmousemove(event) {
  // your original mousemove code here
}
于 2013-09-11T16:44:54.473 回答
1

也许您的显卡在我们的黑名单中。在 about:support 的底部通常有一个关于此的注释。

卡可能因各种原因被列入黑名单,缺少驱动程序/功能,偶尔崩溃......请参阅: http ://www.sitepoint.com/firefox-enable-webgl-blacklisted-graphics-card/

  • 要启用 WebGL,请将 webgl.force-enabled 设置为 true。
  • 要启用图层加速,请将 layers.acceleration.force-enabled 设置为 true
  • 要在 Windows Vista/7 中启用 Direct2D,请将 gfx.direct2d.force-enabled 设置为 true
于 2013-09-11T09:30:16.877 回答