Просмотр исходного кода

WebGLTextureUtils: Clean up. (#31195)

* WebGLTextureUtils: Clean up.

* clean up

* fix eslint error

* Update WebGLTextureUtils.js

---------

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
林炳权 1 год назад
Родитель
Сommit
8a7655db1a
1 измененных файлов с 19 добавлено и 19 удалено
  1. 19 19
      src/renderers/webgl-fallback/utils/WebGLTextureUtils.js

+ 19 - 19
src/renderers/webgl-fallback/utils/WebGLTextureUtils.js

@@ -497,25 +497,6 @@ class WebGLTextureUtils {
 		if ( texture.isRenderTargetTexture || ( textureGPU === undefined /* unsupported texture format */ ) )
 			return;
 
-		const getImage = ( source ) => {
-
-			if ( source.isDataTexture ) {
-
-				return source.image.data;
-
-			} else if ( ( typeof HTMLImageElement !== 'undefined' && source instanceof HTMLImageElement ) ||
-				( typeof HTMLCanvasElement !== 'undefined' && source instanceof HTMLCanvasElement ) ||
-				( typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap ) ||
-				( typeof OffscreenCanvas !== 'undefined' && source instanceof OffscreenCanvas ) ) {
-
-				return source;
-
-			}
-
-			return source.data;
-
-		};
-
 		this.backend.state.bindTexture( glTextureType, textureGPU );
 
 		this.setTextureParameters( glTextureType, texture );
@@ -1154,4 +1135,23 @@ class WebGLTextureUtils {
 
 }
 
+function getImage( source ) {
+
+	if ( source.isDataTexture ) {
+
+		return source.image.data;
+
+	} else if ( ( typeof HTMLImageElement !== 'undefined' && source instanceof HTMLImageElement ) ||
+		( typeof HTMLCanvasElement !== 'undefined' && source instanceof HTMLCanvasElement ) ||
+		( typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap ) ||
+		( typeof OffscreenCanvas !== 'undefined' && source instanceof OffscreenCanvas ) ) {
+
+		return source;
+
+	}
+
+	return source.data;
+
+}
+
 export default WebGLTextureUtils;

粤ICP备19079148号