4
4
5
5
import { LinearFilter , NearestFilter , RGBFormat , RGBAFormat , DepthFormat , DepthStencilFormat , UnsignedShortType , UnsignedIntType , UnsignedInt248Type , FloatType , HalfFloatType , ClampToEdgeWrapping , NearestMipMapLinearFilter , NearestMipMapNearestFilter } from '../../constants' ;
6
6
import { _Math } from '../../math/Math' ;
7
+ import { toGL } from './WebGLUtils' ;
7
8
8
- function WebGLTextures ( _gl , extensions , state , properties , capabilities , utils , infoMemory ) {
9
+ function WebGLTextures ( _gl , extensions , state , properties , capabilities , infoMemory ) {
9
10
10
11
var _isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && _gl instanceof WebGL2RenderingContext ) ;
11
12
@@ -264,8 +265,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
264
265
265
266
var image = cubeImage [ 0 ] ,
266
267
isPowerOfTwoImage = isPowerOfTwo ( image ) ,
267
- glFormat = utils . convert ( texture . format ) ,
268
- glType = utils . convert ( texture . type ) ;
268
+ glFormat = toGL ( texture . format ) ,
269
+ glType = toGL ( texture . type ) ;
269
270
270
271
setTextureParameters ( _gl . TEXTURE_CUBE_MAP , texture , isPowerOfTwoImage ) ;
271
272
@@ -349,11 +350,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
349
350
350
351
if ( isPowerOfTwoImage ) {
351
352
352
- _gl . texParameteri ( textureType , _gl . TEXTURE_WRAP_S , utils . convert ( texture . wrapS ) ) ;
353
- _gl . texParameteri ( textureType , _gl . TEXTURE_WRAP_T , utils . convert ( texture . wrapT ) ) ;
353
+ _gl . texParameteri ( textureType , _gl . TEXTURE_WRAP_S , toGL ( texture . wrapS ) ) ;
354
+ _gl . texParameteri ( textureType , _gl . TEXTURE_WRAP_T , toGL ( texture . wrapT ) ) ;
354
355
355
- _gl . texParameteri ( textureType , _gl . TEXTURE_MAG_FILTER , utils . convert ( texture . magFilter ) ) ;
356
- _gl . texParameteri ( textureType , _gl . TEXTURE_MIN_FILTER , utils . convert ( texture . minFilter ) ) ;
356
+ _gl . texParameteri ( textureType , _gl . TEXTURE_MAG_FILTER , toGL ( texture . magFilter ) ) ;
357
+ _gl . texParameteri ( textureType , _gl . TEXTURE_MIN_FILTER , toGL ( texture . minFilter ) ) ;
357
358
358
359
} else {
359
360
@@ -425,8 +426,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
425
426
}
426
427
427
428
var isPowerOfTwoImage = isPowerOfTwo ( image ) ,
428
- glFormat = utils . convert ( texture . format ) ,
429
- glType = utils . convert ( texture . type ) ;
429
+ glFormat = toGL ( texture . format ) ,
430
+ glType = toGL ( texture . type ) ;
430
431
431
432
setTextureParameters ( _gl . TEXTURE_2D , texture , isPowerOfTwoImage ) ;
432
433
@@ -460,7 +461,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
460
461
console . warn ( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' ) ;
461
462
462
463
texture . type = UnsignedShortType ;
463
- glType = utils . convert ( texture . type ) ;
464
+ glType = toGL ( texture . type ) ;
464
465
465
466
}
466
467
@@ -480,7 +481,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
480
481
console . warn ( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' ) ;
481
482
482
483
texture . type = UnsignedInt248Type ;
483
- glType = utils . convert ( texture . type ) ;
484
+ glType = toGL ( texture . type ) ;
484
485
485
486
}
486
487
@@ -577,8 +578,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
577
578
// Setup storage for target texture and bind it to correct framebuffer
578
579
function setupFrameBufferTexture ( framebuffer , renderTarget , attachment , textureTarget ) {
579
580
580
- var glFormat = utils . convert ( renderTarget . texture . format ) ;
581
- var glType = utils . convert ( renderTarget . texture . type ) ;
581
+ var glFormat = toGL ( renderTarget . texture . format ) ;
582
+ var glType = toGL ( renderTarget . texture . type ) ;
582
583
state . texImage2D ( textureTarget , 0 , glFormat , renderTarget . width , renderTarget . height , 0 , glFormat , glType , null ) ;
583
584
_gl . bindFramebuffer ( _gl . FRAMEBUFFER , framebuffer ) ;
584
585
_gl . framebufferTexture2D ( _gl . FRAMEBUFFER , attachment , textureTarget , properties . get ( renderTarget . texture ) . __webglTexture , 0 ) ;
0 commit comments