Aframe asset unload

别等时光非礼了梦想. 提交于 2019-12-08 13:34:51

问题


I have created an aframe animation where lots of external png files are loaded in a sequence. Works like a charm on desktop, crashes smartphones with little RAM.

Is there anything like an "asset unload" in aframe such as in three.js?

Thanks for your answers.


回答1:


In 0.2.0, you have to do:

AFRAME.utils.texture.textureCache[yourimagesrc]['1 1'].then(function (texture) { texture.dispose(); });

In master (upcoming 0.3.0), you have to do:

document.querySelector('a-scene').systems.material.textureCache[yourimagesrc]['1 1'].then(function (texture) { texture.dsipose(); });

I had some work doing automatic texture disposal when no longer used. I hope to reintroduce it in 0.4.0. For now, blame current mobile browsers as being ill-suited for VR.



来源:https://stackoverflow.com/questions/38520628/aframe-asset-unload

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!