Skip to content

Commit 8a7655d

Browse files
linbingquanMugen87
andauthored
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 parent 54e3591 commit 8a7655d

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -497,25 +497,6 @@ class WebGLTextureUtils {
497497
if ( texture.isRenderTargetTexture || ( textureGPU === undefined /* unsupported texture format */ ) )
498498
return;
499499

500-
const getImage = ( source ) => {
501-
502-
if ( source.isDataTexture ) {
503-
504-
return source.image.data;
505-
506-
} else if ( ( typeof HTMLImageElement !== 'undefined' && source instanceof HTMLImageElement ) ||
507-
( typeof HTMLCanvasElement !== 'undefined' && source instanceof HTMLCanvasElement ) ||
508-
( typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap ) ||
509-
( typeof OffscreenCanvas !== 'undefined' && source instanceof OffscreenCanvas ) ) {
510-
511-
return source;
512-
513-
}
514-
515-
return source.data;
516-
517-
};
518-
519500
this.backend.state.bindTexture( glTextureType, textureGPU );
520501

521502
this.setTextureParameters( glTextureType, texture );
@@ -1154,4 +1135,23 @@ class WebGLTextureUtils {
11541135

11551136
}
11561137

1138+
function getImage( source ) {
1139+
1140+
if ( source.isDataTexture ) {
1141+
1142+
return source.image.data;
1143+
1144+
} else if ( ( typeof HTMLImageElement !== 'undefined' && source instanceof HTMLImageElement ) ||
1145+
( typeof HTMLCanvasElement !== 'undefined' && source instanceof HTMLCanvasElement ) ||
1146+
( typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap ) ||
1147+
( typeof OffscreenCanvas !== 'undefined' && source instanceof OffscreenCanvas ) ) {
1148+
1149+
return source;
1150+
1151+
}
1152+
1153+
return source.data;
1154+
1155+
}
1156+
11571157
export default WebGLTextureUtils;

0 commit comments

Comments
 (0)