使用SMAAPass时,会记录警告:
THREE.WebGLRenderer: Texture marked for update but image is incomplete
发生此警告的原因是Image.complete
为false,设置Image.complete
它看起来像是异步的。
如果可能的话,还请提供一个实例。 您可以从以下模板开始:
你是对的。 一个简单的修复可能类似于以下代码部分。 理想情况下,它将放置在SMAAPass
此行之后:
var self = this;
setTimeout( function () {
// assigning data to HTMLImageElement.src is asynchronous (see #15162)
// using setTimeout() avoids the warning "Texture marked for update but image is incomplete"
self.searchTexture.needsUpdate = true;
self.areaTexture.needsUpdate = true;
}, 0 );
您想对这些更改进行公关吗?
在我看来,这似乎是一种骇客。 请考虑更常规的模式:
var image = new Image();
image.src = dataURL;
var texture = new THREE.Texture( image );
image.onload = function () {
texture.needsUpdate = true;
};
确实,那更好nice
我将其更改为onload回调。
最有用的评论
在我看来,这似乎是一种骇客。 请考虑更常规的模式: