问题
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