|
@@ -191,7 +191,7 @@ class Textures extends DataMap {
|
|
|
|
|
|
for ( const image of texture.images ) {
|
|
|
|
|
|
- images.push( this._getUploadImage( image ) );
|
|
|
+ images.push( image );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -199,7 +199,7 @@ class Textures extends DataMap {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- options.image = this._getUploadImage( image );
|
|
|
+ options.image = image;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -317,38 +317,6 @@ class Textures extends DataMap {
|
|
|
|
|
|
}
|
|
|
|
|
|
- _getUploadImage( image ) {
|
|
|
-
|
|
|
- if ( this._isHTMLImage( image ) ) {
|
|
|
-
|
|
|
- return this._imageToCanvas( image );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return image;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- _imageToCanvas( image ) {
|
|
|
-
|
|
|
- const { width, height } = image;
|
|
|
-
|
|
|
- // eslint-disable-next-line compat/compat
|
|
|
- const canvas = new OffscreenCanvas( width, height );
|
|
|
-
|
|
|
- const context = canvas.getContext( '2d' );
|
|
|
- context.drawImage( image, 0, 0, width, height );
|
|
|
-
|
|
|
- return canvas;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- _isHTMLImage( image ) {
|
|
|
-
|
|
|
- return ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) || ( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
_destroyTexture( texture ) {
|
|
|
|
|
|
this.backend.destroySampler( texture );
|