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 );
変更を加えてPRを行いますか?
それは私にはハックのように見えます。 より一般的なパターンを検討してください。
var image = new Image();
image.src = dataURL;
var texture = new THREE.Texture( image );
image.onload = function () {
texture.needsUpdate = true;
};
確かに、それはより良いです👍
onloadコールバックに変更します。
最も参考になるコメント
それは私にはハックのように見えます。 より一般的なパターンを検討してください。