|
@@ -415,6 +415,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
array.push( texture.wrapS );
|
|
|
array.push( texture.wrapT );
|
|
|
+ array.push( texture.wrapR || 0 );
|
|
|
array.push( texture.magFilter );
|
|
|
array.push( texture.minFilter );
|
|
|
array.push( texture.anisotropy );
|
|
@@ -671,7 +672,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
let textureType = _gl.TEXTURE_2D;
|
|
|
|
|
|
- if ( texture.isDataArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;
|
|
|
+ if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;
|
|
|
if ( texture.isData3DTexture ) textureType = _gl.TEXTURE_3D;
|
|
|
|
|
|
const forceUpload = initTexture( textureProperties, texture );
|
|
@@ -853,45 +854,97 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
} else if ( texture.isCompressedTexture ) {
|
|
|
|
|
|
- if ( useTexStorage && allocateMemory ) {
|
|
|
+ if ( texture.isCompressedArrayTexture ) {
|
|
|
|
|
|
- state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
|
+ if ( useTexStorage && allocateMemory ) {
|
|
|
|
|
|
- }
|
|
|
+ state.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height, image.depth );
|
|
|
|
|
|
- for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
|
+ }
|
|
|
|
|
|
- mipmap = mipmaps[ i ];
|
|
|
+ for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
|
|
|
|
- if ( texture.format !== RGBAFormat ) {
|
|
|
+ mipmap = mipmaps[ i ];
|
|
|
|
|
|
- if ( glFormat !== null ) {
|
|
|
+ if ( texture.format !== RGBAFormat ) {
|
|
|
|
|
|
- if ( useTexStorage ) {
|
|
|
+ if ( glFormat !== null ) {
|
|
|
+
|
|
|
+ if ( useTexStorage ) {
|
|
|
+
|
|
|
+ state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );
|
|
|
|
|
|
- state.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
|
|
|
+ } else {
|
|
|
+
|
|
|
+ state.compressedTexImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0 );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- state.compressedTexImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
|
|
|
+ console.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- console.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
|
+ if ( useTexStorage ) {
|
|
|
+
|
|
|
+ state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ state.texImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
- } else {
|
|
|
+ }
|
|
|
|
|
|
- if ( useTexStorage ) {
|
|
|
+ } else {
|
|
|
|
|
|
- state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
|
+ if ( useTexStorage && allocateMemory ) {
|
|
|
+
|
|
|
+ state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
|
+
|
|
|
+ mipmap = mipmaps[ i ];
|
|
|
+
|
|
|
+ if ( texture.format !== RGBAFormat ) {
|
|
|
+
|
|
|
+ if ( glFormat !== null ) {
|
|
|
+
|
|
|
+ if ( useTexStorage ) {
|
|
|
+
|
|
|
+ state.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ state.compressedTexImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ console.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- state.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
|
+ if ( useTexStorage ) {
|
|
|
+
|
|
|
+ state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ state.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|