Explorar o código

GLTFExporter allow OffscreenCanvas as image source (#27872)

Co-authored-by: Kevin Meijer <[email protected]>
strunkie30 hai 1 ano
pai
achega
f9e584866c
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      examples/jsm/exporters/GLTFExporter.js

+ 3 - 2
examples/jsm/exporters/GLTFExporter.js

@@ -1290,13 +1290,14 @@ class GLTFWriter {
 
 				if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
 					( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
-					( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
+					( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ||
+					( typeof OffscreenCanvas !== 'undefined' && image instanceof OffscreenCanvas ) ) {
 
 					ctx.drawImage( image, 0, 0, canvas.width, canvas.height );
 
 				} else {
 
-					throw new Error( 'THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement or ImageBitmap.' );
+					throw new Error( 'THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.' );
 
 				}