未验证 提交 ccbee9fc 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #15804 from merwaaan/fix-tgaloader-webworkers

Fixed TGALoader failing with web workers because of undefined document
......@@ -522,7 +522,9 @@ THREE.TGALoader.prototype = {
//
var canvas = document.createElement( 'canvas' );
var useOffscreen = typeof OffscreenCanvas !== 'undefined';
var canvas = useOffscreen ? new OffscreenCanvas(header.width, header.height) : document.createElement( 'canvas' );
canvas.width = header.width;
canvas.height = header.height;
......@@ -534,7 +536,7 @@ THREE.TGALoader.prototype = {
context.putImageData( imageData, 0, 0 );
return canvas;
return useOffscreen ? canvas.transferToImageBitmap() : canvas;
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册