Browse Source

Add new render target types for 3D and array textures. (#23498)

* Add new render target types for 3D and array textures.

* Rename data textures.

* Examples: Clean up.

* Remove options parameter from new render targets.
Michael Herzog 3 years ago
parent
commit
f9cd9cab03
33 changed files with 126 additions and 89 deletions
  1. 0 0
      docs/api/en/textures/Data3DTexture.html
  2. 1 1
      docs/api/en/textures/DataArrayTexture.html
  3. 0 0
      docs/api/zh/textures/Data3DTexture.html
  4. 1 1
      docs/api/zh/textures/DataTexture2DArray.html
  5. 4 4
      docs/list.json
  6. 1 1
      examples/js/loaders/LUT3dlLoader.js
  7. 1 1
      examples/js/loaders/LUTCubeLoader.js
  8. 2 2
      examples/js/loaders/VOXLoader.js
  9. 2 2
      examples/js/postprocessing/LUTPass.js
  10. 2 2
      examples/jsm/loaders/LUT3dlLoader.js
  11. 2 2
      examples/jsm/loaders/LUTCubeLoader.js
  12. 3 3
      examples/jsm/loaders/VOXLoader.js
  13. 2 2
      examples/jsm/postprocessing/LUTPass.js
  14. 2 2
      examples/jsm/renderers/webgpu/WebGPUTextures.js
  15. 1 1
      examples/webgl2_materials_texture2darray.html
  16. 1 1
      examples/webgl2_materials_texture3d.html
  17. 2 2
      examples/webgl2_materials_texture3d_partialupdate.html
  18. 4 10
      examples/webgl2_rendertarget_texture2darray.html
  19. 1 1
      examples/webgl2_volume_cloud.html
  20. 2 2
      examples/webgl2_volume_instancing.html
  21. 1 1
      examples/webgl2_volume_perlin.html
  22. 16 0
      src/Three.Legacy.js
  23. 4 2
      src/Three.js
  24. 22 0
      src/renderers/WebGL3DRenderTarget.js
  25. 22 0
      src/renderers/WebGLArrayRenderTarget.js
  26. 0 12
      src/renderers/WebGLRenderTarget.js
  27. 4 4
      src/renderers/WebGLRenderer.js
  28. 2 2
      src/renderers/webgl/WebGLMorphtargets.js
  29. 7 11
      src/renderers/webgl/WebGLTextures.js
  30. 8 8
      src/renderers/webgl/WebGLUniforms.js
  31. 3 3
      src/textures/Data3DTexture.js
  32. 3 3
      src/textures/DataArrayTexture.js
  33. 0 3
      src/textures/DataTexture.js

+ 0 - 0
docs/api/en/textures/DataTexture3D.html → docs/api/en/textures/Data3DTexture.html


+ 1 - 1
docs/api/en/textures/DataTexture2DArray.html → docs/api/en/textures/DataArrayTexture.html

@@ -66,7 +66,7 @@
 
 		// used the buffer to create a [name]
 
-		const texture = new THREE.DataTexture2DArray( data, width, height, depth );
+		const texture = new THREE.DataArrayTexture( data, width, height, depth );
 		texture.needsUpdate = true;
 		</code>
 

+ 0 - 0
docs/api/zh/textures/DataTexture3D.html → docs/api/zh/textures/Data3DTexture.html


+ 1 - 1
docs/api/zh/textures/DataTexture2DArray.html

@@ -66,7 +66,7 @@
 
 		// used the buffer to create a [name]
 
-		const texture = new THREE.DataTexture2DArray( data, width, height, depth );
+		const texture = new THREE.DataArrayTexture( data, width, height, depth );
 		texture.needsUpdate = true;
 		</code>
 

+ 4 - 4
docs/list.json

@@ -310,9 +310,9 @@
 				"CanvasTexture": "api/en/textures/CanvasTexture",
 				"CompressedTexture": "api/en/textures/CompressedTexture",
 				"CubeTexture": "api/en/textures/CubeTexture",
+				"Data3DTexture": "api/en/textures/Data3DTexture",
+				"DataArrayTexture": "api/en/textures/DataArrayTexture",
 				"DataTexture": "api/en/textures/DataTexture",
-				"DataTexture2DArray": "api/en/textures/DataTexture2DArray",
-				"DataTexture3D": "api/en/textures/DataTexture3D",
 				"DepthTexture": "api/en/textures/DepthTexture",
 				"FramebufferTexture": "api/en/textures/FramebufferTexture",
 				"Source": "api/en/textures/Source",
@@ -809,9 +809,9 @@
 				"CanvasTexture": "api/zh/textures/CanvasTexture",
 				"CompressedTexture": "api/zh/textures/CompressedTexture",
 				"CubeTexture": "api/zh/textures/CubeTexture",
+				"DataArrayTexture": "api/zh/textures/DataArrayTexture",
+				"Data3DTexture": "api/zh/textures/Data3DTexture",
 				"DataTexture": "api/zh/textures/DataTexture",
-				"DataTexture2DArray": "api/zh/textures/DataTexture2DArray",
-				"DataTexture3D": "api/zh/textures/DataTexture3D",
 				"DepthTexture": "api/zh/textures/DepthTexture",
 				"FramebufferTexture": "api/zh/textures/FramebufferTexture",
 				"Source": "api/zh/textures/Source",

+ 1 - 1
examples/js/loaders/LUT3dlLoader.js

@@ -110,7 +110,7 @@
 			texture.wrapT = THREE.ClampToEdgeWrapping;
 			texture.generateMipmaps = false;
 			texture.needsUpdate = true;
-			const texture3D = new THREE.DataTexture3D();
+			const texture3D = new THREE.Data3DTexture();
 			texture3D.image.data = data;
 			texture3D.image.width = size;
 			texture3D.image.height = size;

+ 1 - 1
examples/js/loaders/LUTCubeLoader.js

@@ -109,7 +109,7 @@
 			texture.wrapT = THREE.ClampToEdgeWrapping;
 			texture.generateMipmaps = false;
 			texture.needsUpdate = true;
-			const texture3D = new THREE.DataTexture3D();
+			const texture3D = new THREE.Data3DTexture();
 			texture3D.image.data = data;
 			texture3D.image.width = size;
 			texture3D.image.height = size;

+ 2 - 2
examples/js/loaders/VOXLoader.js

@@ -211,7 +211,7 @@
 
 	}
 
-	class VOXDataTexture3D extends THREE.DataTexture3D {
+	class VOXData3DTexture extends THREE.Data3DTexture {
 
 		constructor( chunk ) {
 
@@ -242,7 +242,7 @@
 
 	}
 
-	THREE.VOXDataTexture3D = VOXDataTexture3D;
+	THREE.VOXData3DTexture = VOXData3DTexture;
 	THREE.VOXLoader = VOXLoader;
 	THREE.VOXMesh = VOXMesh;
 

+ 2 - 2
examples/js/postprocessing/LUTPass.js

@@ -124,7 +124,7 @@
 
 				if ( v ) {
 
-					const is3dTextureDefine = v.isDataTexture3D ? 1 : 0;
+					const is3dTextureDefine = v.isData3DTexture ? 1 : 0;
 
 					if ( is3dTextureDefine !== material.defines.USE_3DTEXTURE ) {
 
@@ -135,7 +135,7 @@
 
 					material.uniforms.lutSize.value = v.image.width;
 
-					if ( v.isDataTexture3D ) {
+					if ( v.isData3DTexture ) {
 
 						material.uniforms.lut3d.value = v;
 

+ 2 - 2
examples/jsm/loaders/LUT3dlLoader.js

@@ -4,7 +4,7 @@ import {
 	Loader,
 	FileLoader,
 	DataTexture,
-	DataTexture3D,
+	Data3DTexture,
 	RGBAFormat,
 	UnsignedByteType,
 	ClampToEdgeWrapping,
@@ -125,7 +125,7 @@ export class LUT3dlLoader extends Loader {
 		texture.generateMipmaps = false;
 		texture.needsUpdate = true;
 
-		const texture3D = new DataTexture3D();
+		const texture3D = new Data3DTexture();
 		texture3D.image.data = data;
 		texture3D.image.width = size;
 		texture3D.image.height = size;

+ 2 - 2
examples/jsm/loaders/LUTCubeLoader.js

@@ -5,7 +5,7 @@ import {
 	FileLoader,
 	Vector3,
 	DataTexture,
-	DataTexture3D,
+	Data3DTexture,
 	UnsignedByteType,
 	ClampToEdgeWrapping,
 	LinearFilter,
@@ -125,7 +125,7 @@ export class LUTCubeLoader extends Loader {
 		texture.generateMipmaps = false;
 		texture.needsUpdate = true;
 
-		const texture3D = new DataTexture3D();
+		const texture3D = new Data3DTexture();
 		texture3D.image.data = data;
 		texture3D.image.width = size;
 		texture3D.image.height = size;

+ 3 - 3
examples/jsm/loaders/VOXLoader.js

@@ -1,6 +1,6 @@
 import {
 	BufferGeometry,
-	DataTexture3D,
+	Data3DTexture,
 	FileLoader,
 	Float32BufferAttribute,
 	Loader,
@@ -266,7 +266,7 @@ class VOXMesh extends Mesh {
 
 }
 
-class VOXDataTexture3D extends DataTexture3D {
+class VOXData3DTexture extends Data3DTexture {
 
 	constructor( chunk ) {
 
@@ -302,4 +302,4 @@ class VOXDataTexture3D extends DataTexture3D {
 
 }
 
-export { VOXLoader, VOXMesh, VOXDataTexture3D };
+export { VOXLoader, VOXMesh, VOXData3DTexture };

+ 2 - 2
examples/jsm/postprocessing/LUTPass.js

@@ -117,7 +117,7 @@ class LUTPass extends ShaderPass {
 
 			if ( v ) {
 
-				const is3dTextureDefine = v.isDataTexture3D ? 1 : 0;
+				const is3dTextureDefine = v.isData3DTexture ? 1 : 0;
 				if ( is3dTextureDefine !== material.defines.USE_3DTEXTURE ) {
 
 					material.defines.USE_3DTEXTURE = is3dTextureDefine;
@@ -126,7 +126,7 @@ class LUTPass extends ShaderPass {
 				}
 
 				material.uniforms.lutSize.value = v.image.width;
-				if ( v.isDataTexture3D ) {
+				if ( v.isData3DTexture ) {
 
 					material.uniforms.lut3d.value = v;
 

+ 2 - 2
examples/jsm/renderers/webgpu/WebGPUTextures.js

@@ -349,7 +349,7 @@ class WebGPUTextures {
 
 		// transfer texture data
 
-		if ( texture.isDataTexture || texture.isDataTexture2DArray || texture.isDataTexture3D ) {
+		if ( texture.isDataTexture || texture.isDataArrayTexture || texture.isData3DTexture ) {
 
 			this._copyBufferToTexture( image, format, textureGPU );
 
@@ -528,7 +528,7 @@ class WebGPUTextures {
 
 		let dimension;
 
-		if ( texture.isDataTexture3D ) {
+		if ( texture.isData3DTexture ) {
 
 			dimension = GPUTextureDimension.ThreeD;
 

+ 1 - 1
examples/webgl2_materials_texture2darray.html

@@ -107,7 +107,7 @@
 						const zip = unzipSync( new Uint8Array( data ) );
 						const array = new Uint8Array( zip[ 'head256x256x109' ].buffer );
 
-						const texture = new THREE.DataTexture2DArray( array, 256, 256, 109 );
+						const texture = new THREE.DataArrayTexture( array, 256, 256, 109 );
 						texture.format = THREE.RedFormat;
 						texture.needsUpdate = true;
 

+ 1 - 1
examples/webgl2_materials_texture3d.html

@@ -97,7 +97,7 @@
 				// THREEJS will select R32F (33326) based on the THREE.RedFormat and THREE.FloatType.
 				// Also see https://www.khronos.org/registry/webgl/specs/latest/2.0/#TEXTURE_TYPES_FORMATS_FROM_DOM_ELEMENTS_TABLE
 				// TODO: look the dtype up in the volume metadata
-				const texture = new THREE.DataTexture3D( volume.data, volume.xLength, volume.yLength, volume.zLength );
+				const texture = new THREE.Data3DTexture( volume.data, volume.xLength, volume.yLength, volume.zLength );
 				texture.format = THREE.RedFormat;
 				texture.type = THREE.FloatType;
 				texture.minFilter = texture.magFilter = THREE.LinearFilter;

+ 2 - 2
examples/webgl2_materials_texture3d_partialupdate.html

@@ -75,7 +75,7 @@
 
 				}
 
-				return new THREE.DataTexture3D( data, size, size, size );
+				return new THREE.Data3DTexture( data, size, size, size );
 
 			}
 
@@ -115,7 +115,7 @@
 
 				// Texture
 
-				const texture = new THREE.DataTexture3D(
+				const texture = new THREE.Data3DTexture(
 					new Uint8Array( INITIAL_CLOUD_SIZE * INITIAL_CLOUD_SIZE * INITIAL_CLOUD_SIZE ).fill( 0 ),
 					INITIAL_CLOUD_SIZE,
 					INITIAL_CLOUD_SIZE,

+ 4 - 10
examples/webgl2_rendertarget_texture2darray.html

@@ -138,13 +138,8 @@
 			const postProcessScene = new THREE.Scene();
 			const postProcessCamera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 
-			const renderTargetTexture = new THREE.DataTexture2DArray();
-			renderTargetTexture.format = THREE.RedFormat;
-			renderTargetTexture.type = THREE.UnsignedByteType;
-
-			const renderTarget = new THREE.WebGLRenderTarget( DIMENSIONS.width, DIMENSIONS.height );
-			renderTarget.depth = DIMENSIONS.depth;
-			renderTarget.setTexture( renderTargetTexture );
+			const renderTarget = new THREE.WebGLArrayRenderTarget( DIMENSIONS.width, DIMENSIONS.height, DIMENSIONS.depth );
+			renderTarget.texture.format = THREE.RedFormat;
 
 			const postProcessMaterial = new THREE.ShaderMaterial( {
 				uniforms: {
@@ -207,7 +202,7 @@
 						var zip = unzipSync( new Uint8Array( data ) );
 						const array = new Uint8Array( zip[ 'head256x256x109' ].buffer );
 
-						const texture = new THREE.DataTexture2DArray( array, DIMENSIONS.width, DIMENSIONS.height, DIMENSIONS.depth );
+						const texture = new THREE.DataArrayTexture( array, DIMENSIONS.width, DIMENSIONS.height, DIMENSIONS.depth );
 						texture.format = THREE.RedFormat;
 						texture.needsUpdate = true;
 
@@ -282,8 +277,7 @@
 
 			function render() {
 
-				// Step 1 - Render the input DataTexture2DArray into a
-				// DataTexture2DArray render target.
+				// Step 1 - Render the input DataArrayTexture into render target
 				renderTo2DArray();
 
 				// Step 2 - Renders the scene containing the plane with a material

+ 1 - 1
examples/webgl2_volume_cloud.html

@@ -104,7 +104,7 @@
 
 				}
 
-				const texture = new THREE.DataTexture3D( data, size, size, size );
+				const texture = new THREE.Data3DTexture( data, size, size, size );
 				texture.format = THREE.RedFormat;
 				texture.minFilter = THREE.LinearFilter;
 				texture.magFilter = THREE.LinearFilter;

+ 2 - 2
examples/webgl2_volume_instancing.html

@@ -27,7 +27,7 @@
 		<script type="module">
 			import * as THREE from 'three';
 			import { OrbitControls } from './jsm/controls/OrbitControls.js';
-			import { VOXLoader, VOXDataTexture3D } from './jsm/loaders/VOXLoader.js';
+			import { VOXLoader, VOXData3DTexture } from './jsm/loaders/VOXLoader.js';
 
 			import WebGL from './jsm/capabilities/WebGL.js';
 
@@ -182,7 +182,7 @@
 						const material = new THREE.RawShaderMaterial( {
 							glslVersion: THREE.GLSL3,
 							uniforms: {
-								map: { value: new VOXDataTexture3D( chunk ) },
+								map: { value: new VOXData3DTexture( chunk ) },
 								cameraPos: { value: new THREE.Vector3() }
 							},
 							vertexShader,

+ 1 - 1
examples/webgl2_volume_perlin.html

@@ -85,7 +85,7 @@
 
 				}
 
-				const texture = new THREE.DataTexture3D( data, size, size, size );
+				const texture = new THREE.Data3DTexture( data, size, size, size );
 				texture.format = THREE.RedFormat;
 				texture.minFilter = THREE.LinearFilter;
 				texture.magFilter = THREE.LinearFilter;

+ 16 - 0
src/Three.Legacy.js

@@ -77,6 +77,8 @@ import { ImageUtils } from './extras/ImageUtils.js';
 import { Shape } from './extras/core/Shape.js';
 import { CubeCamera } from './cameras/CubeCamera.js';
 import { Scene } from './scenes/Scene.js';
+import { DataArrayTexture } from './textures/DataArrayTexture.js';
+import { Data3DTexture } from './textures/Data3DTexture.js';
 
 export { MathUtils as Math };
 
@@ -1994,3 +1996,17 @@ export function WebGLMultisampleRenderTarget( width, height, options ) {
 	return renderTarget;
 
 }
+
+export function DataTexture2DArray( data, width, height, depth ) {
+
+	console.warn( 'THREE.DataTexture2DArray has been renamed to DataArrayTexture.' );
+	return new DataArrayTexture( data, width, height, depth );
+
+}
+
+export function DataTexture3D( data, width, height, depth ) {
+
+	console.warn( 'THREE.DataTexture3D has been renamed to Data3DTexture.' );
+	return new Data3DTexture( data, width, height, depth );
+
+}

+ 4 - 2
src/Three.js

@@ -1,5 +1,7 @@
 import { REVISION } from './constants.js';
 
+export { WebGLArrayRenderTarget } from './renderers/WebGLArrayRenderTarget.js';
+export { WebGL3DRenderTarget } from './renderers/WebGL3DRenderTarget.js';
 export { WebGLMultipleRenderTargets } from './renderers/WebGLMultipleRenderTargets.js';
 export { WebGLCubeRenderTarget } from './renderers/WebGLCubeRenderTarget.js';
 export { WebGLRenderTarget } from './renderers/WebGLRenderTarget.js';
@@ -27,8 +29,8 @@ export { Group } from './objects/Group.js';
 export { VideoTexture } from './textures/VideoTexture.js';
 export { FramebufferTexture } from './textures/FramebufferTexture.js';
 export { DataTexture } from './textures/DataTexture.js';
-export { DataTexture2DArray } from './textures/DataTexture2DArray.js';
-export { DataTexture3D } from './textures/DataTexture3D.js';
+export { DataArrayTexture } from './textures/DataArrayTexture.js';
+export { Data3DTexture } from './textures/Data3DTexture.js';
 export { CompressedTexture } from './textures/CompressedTexture.js';
 export { CubeTexture } from './textures/CubeTexture.js';
 export { CanvasTexture } from './textures/CanvasTexture.js';

+ 22 - 0
src/renderers/WebGL3DRenderTarget.js

@@ -0,0 +1,22 @@
+import { WebGLRenderTarget } from './WebGLRenderTarget.js';
+import { Data3DTexture } from '../textures/Data3DTexture.js';
+
+class WebGL3DRenderTarget extends WebGLRenderTarget {
+
+	constructor( width, height, depth ) {
+
+		super( width, height );
+
+		this.depth = depth;
+
+		this.texture = new Data3DTexture( null, width, height, depth );
+
+		this.texture.isRenderTargetTexture = true;
+
+	}
+
+}
+
+WebGL3DRenderTarget.prototype.isWebGL3DRenderTarget = true;
+
+export { WebGL3DRenderTarget };

+ 22 - 0
src/renderers/WebGLArrayRenderTarget.js

@@ -0,0 +1,22 @@
+import { WebGLRenderTarget } from './WebGLRenderTarget.js';
+import { DataArrayTexture } from '../textures/DataArrayTexture.js';
+
+class WebGLArrayRenderTarget extends WebGLRenderTarget {
+
+	constructor( width, height, depth ) {
+
+		super( width, height );
+
+		this.depth = depth;
+
+		this.texture = new DataArrayTexture( null, width, height, depth );
+
+		this.texture.isRenderTargetTexture = true;
+
+	}
+
+}
+
+WebGLArrayRenderTarget.prototype.isWebGLArrayRenderTarget = true;
+
+export { WebGLArrayRenderTarget };

+ 0 - 12
src/renderers/WebGLRenderTarget.js

@@ -41,18 +41,6 @@ class WebGLRenderTarget extends EventDispatcher {
 
 	}
 
-	setTexture( texture ) {
-
-		texture.image = {
-			width: this.width,
-			height: this.height,
-			depth: this.depth
-		};
-
-		this.texture = texture;
-
-	}
-
 	setSize( width, height, depth = 1 ) {
 
 		if ( this.width !== width || this.height !== height || this.depth !== depth ) {

+ 4 - 4
src/renderers/WebGLRenderer.js

@@ -1866,7 +1866,7 @@ function WebGLRenderer( parameters = {} ) {
 
 			const texture = renderTarget.texture;
 
-			if ( texture.isDataTexture3D || texture.isDataTexture2DArray ) {
+			if ( texture.isData3DTexture || texture.isDataArrayTexture ) {
 
 				isRenderTarget3D = true;
 
@@ -2081,12 +2081,12 @@ function WebGLRenderer( parameters = {} ) {
 		const glType = utils.convert( dstTexture.type );
 		let glTarget;
 
-		if ( dstTexture.isDataTexture3D ) {
+		if ( dstTexture.isData3DTexture ) {
 
 			textures.setTexture3D( dstTexture, 0 );
 			glTarget = _gl.TEXTURE_3D;
 
-		} else if ( dstTexture.isDataTexture2DArray ) {
+		} else if ( dstTexture.isDataArrayTexture ) {
 
 			textures.setTexture2DArray( dstTexture, 0 );
 			glTarget = _gl.TEXTURE_2D_ARRAY;
@@ -2116,7 +2116,7 @@ function WebGLRenderer( parameters = {} ) {
 		_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, sourceBox.min.y );
 		_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, sourceBox.min.z );
 
-		if ( srcTexture.isDataTexture || srcTexture.isDataTexture3D ) {
+		if ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {
 
 			_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data );
 

+ 2 - 2
src/renderers/webgl/WebGLMorphtargets.js

@@ -1,5 +1,5 @@
 import { FloatType, RGBAFormat } from '../../constants.js';
-import { DataTexture2DArray } from '../../textures/DataTexture2DArray.js';
+import { DataArrayTexture } from '../../textures/DataArrayTexture.js';
 import { Vector3 } from '../../math/Vector3.js';
 import { Vector2 } from '../../math/Vector2.js';
 
@@ -81,7 +81,7 @@ function WebGLMorphtargets( gl, capabilities, textures ) {
 
 				const buffer = new Float32Array( width * height * 4 * numberOfMorphTargets );
 
-				const texture = new DataTexture2DArray( buffer, width, height, numberOfMorphTargets );
+				const texture = new DataArrayTexture( buffer, width, height, numberOfMorphTargets );
 				texture.format = RGBAFormat; // using RGBA since RGB might be emulated (and is thus slower)
 				texture.type = FloatType;
 				texture.needsUpdate = true;

+ 7 - 11
src/renderers/webgl/WebGLTextures.js

@@ -662,8 +662,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 		let textureType = _gl.TEXTURE_2D;
 
-		if ( texture.isDataTexture2DArray ) textureType = _gl.TEXTURE_2D_ARRAY;
-		if ( texture.isDataTexture3D ) textureType = _gl.TEXTURE_3D;
+		if ( texture.isDataArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;
+		if ( texture.isData3DTexture ) textureType = _gl.TEXTURE_3D;
 
 		const forceUpload = initTexture( textureProperties, texture );
 		const source = texture.source;
@@ -883,7 +883,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 				}
 
-			} else if ( texture.isDataTexture2DArray ) {
+			} else if ( texture.isDataArrayTexture ) {
 
 				if ( useTexStorage ) {
 
@@ -901,7 +901,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 				}
 
-			} else if ( texture.isDataTexture3D ) {
+			} else if ( texture.isData3DTexture ) {
 
 				if ( useTexStorage ) {
 
@@ -1492,7 +1492,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 		const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
 		const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
-		const isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray;
 		const supportsMips = isPowerOfTwo( renderTarget ) || isWebGL2;
 
 		// Setup framebuffer
@@ -1615,18 +1614,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 			let glTextureType = _gl.TEXTURE_2D;
 
-			if ( isRenderTarget3D ) {
-
-				// Render targets containing layers, i.e: Texture 3D and 2d arrays
+			if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
 
 				if ( isWebGL2 ) {
 
-					const isTexture3D = texture.isDataTexture3D;
-					glTextureType = isTexture3D ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
+					glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
 
 				} else {
 
-					console.warn( 'THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.' );
+					console.error( 'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );
 
 				}
 

+ 8 - 8
src/renderers/webgl/WebGLUniforms.js

@@ -43,12 +43,12 @@
 
 import { CubeTexture } from '../../textures/CubeTexture.js';
 import { Texture } from '../../textures/Texture.js';
-import { DataTexture2DArray } from '../../textures/DataTexture2DArray.js';
-import { DataTexture3D } from '../../textures/DataTexture3D.js';
+import { DataArrayTexture } from '../../textures/DataArrayTexture.js';
+import { Data3DTexture } from '../../textures/Data3DTexture.js';
 
 const emptyTexture = new Texture();
-const emptyTexture2dArray = new DataTexture2DArray();
-const emptyTexture3d = new DataTexture3D();
+const emptyArrayTexture = new DataArrayTexture();
+const empty3dTexture = new Data3DTexture();
 const emptyCubeTexture = new CubeTexture();
 
 // --- Utilities ---
@@ -483,7 +483,7 @@ function setValueT3D1( gl, v, textures ) {
 
 	}
 
-	textures.setTexture3D( v || emptyTexture3d, unit );
+	textures.setTexture3D( v || empty3dTexture, unit );
 
 }
 
@@ -515,7 +515,7 @@ function setValueT2DArray1( gl, v, textures ) {
 
 	}
 
-	textures.setTexture2DArray( v || emptyTexture2dArray, unit );
+	textures.setTexture2DArray( v || emptyArrayTexture, unit );
 
 }
 
@@ -718,7 +718,7 @@ function setValueT3DArray( gl, v, textures ) {
 
 	for ( let i = 0; i !== n; ++ i ) {
 
-		textures.setTexture3D( v[ i ] || emptyTexture3d, units[ i ] );
+		textures.setTexture3D( v[ i ] || empty3dTexture, units[ i ] );
 
 	}
 
@@ -750,7 +750,7 @@ function setValueT2DArrayArray( gl, v, textures ) {
 
 	for ( let i = 0; i !== n; ++ i ) {
 
-		textures.setTexture2DArray( v[ i ] || emptyTexture2dArray, units[ i ] );
+		textures.setTexture2DArray( v[ i ] || emptyArrayTexture, units[ i ] );
 
 	}
 

+ 3 - 3
src/textures/DataTexture3D.js → src/textures/Data3DTexture.js

@@ -1,7 +1,7 @@
 import { Texture } from './Texture.js';
 import { ClampToEdgeWrapping, NearestFilter } from '../constants.js';
 
-class DataTexture3D extends Texture {
+class Data3DTexture extends Texture {
 
 	constructor( data = null, width = 1, height = 1, depth = 1 ) {
 
@@ -30,6 +30,6 @@ class DataTexture3D extends Texture {
 
 }
 
-DataTexture3D.prototype.isDataTexture3D = true;
+Data3DTexture.prototype.isData3DTexture = true;
 
-export { DataTexture3D };
+export { Data3DTexture };

+ 3 - 3
src/textures/DataTexture2DArray.js → src/textures/DataArrayTexture.js

@@ -1,7 +1,7 @@
 import { Texture } from './Texture.js';
 import { ClampToEdgeWrapping, NearestFilter } from '../constants.js';
 
-class DataTexture2DArray extends Texture {
+class DataArrayTexture extends Texture {
 
 	constructor( data = null, width = 1, height = 1, depth = 1 ) {
 
@@ -22,6 +22,6 @@ class DataTexture2DArray extends Texture {
 
 }
 
-DataTexture2DArray.prototype.isDataTexture2DArray = true;
+DataArrayTexture.prototype.isDataArrayTexture = true;
 
-export { DataTexture2DArray };
+export { DataArrayTexture };

+ 0 - 3
src/textures/DataTexture.js

@@ -9,9 +9,6 @@ class DataTexture extends Texture {
 
 		this.image = { data: data, width: width, height: height };
 
-		this.magFilter = magFilter;
-		this.minFilter = minFilter;
-
 		this.generateMipmaps = false;
 		this.flipY = false;
 		this.unpackAlignment = 1;