如何等待图像加载到three.js?我正在做以下事情:
function myClass {
var IMAGE, TEXTURE;
IMAGE = ...; // properly initialised image object
function asyncFunc() {
TEXTURE.minFilter = THREE.LinearFilter;
... // rest of code
}
myClass.prototype.loadSomething = function(args) {
var base64Image = IMAGE.src;
TEXTURE = THREE.ImageUtils.loadTexture(
base64Image,
{},
asyncFunc(args)
);
};
}
在我的main.js中,我呼吁以下内容:
var x = new myClass();
x.loadSomething(args);
但是,我收到TEXTURE
未定义的错误。我希望在加载纹理后调用asyncFunc()
,但它不是。
关于如何处理异步纹理加载的任何想法?