소스 검색

Global: Avoid usage of RGBFormat. (#23219)

Michael Herzog 3 년 전
부모
커밋
e6a7e7d2f3

+ 1 - 1
docs/api/ar/cameras/CubeCamera.html

@@ -17,7 +17,7 @@
 
 
 		<code>
 		<code>
 		// Create cube render target
 		// Create cube render target
-		const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 128, { format: THREE.RGBFormat, generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
+		const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 128, { generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
 
 
 		// Create cube camera
 		// Create cube camera
 		const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget );
 		const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget );

+ 1 - 1
docs/api/en/cameras/CubeCamera.html

@@ -17,7 +17,7 @@
 
 
 		<code>
 		<code>
 		// Create cube render target
 		// Create cube render target
-		const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 128, { format: THREE.RGBFormat, generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
+		const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 128, { generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
 
 
 		// Create cube camera
 		// Create cube camera
 		const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget );
 		const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget );

+ 0 - 5
docs/api/en/materials/Material.html

@@ -128,11 +128,6 @@
 		When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
 		When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
 		</p>
 		</p>
 
 
-		<h3>[property:Number format]</h3>
-		<p>
-		When this property is set to [page:Textures THREE.RGBFormat], the material is considered to be opaque and alpha values are ignored. Default is [page:Textures THREE.RGBAFormat].
-		</p>
-
 		<h3>[property:Boolean stencilWrite]</h3>
 		<h3>[property:Boolean stencilWrite]</h3>
 		<p>
 		<p>
 		Whether stencil operations are performed against the stencil buffer. In order to perform writes or comparisons against the stencil buffer this value must be *true*. Default is *false*.
 		Whether stencil operations are performed against the stencil buffer. In order to perform writes or comparisons against the stencil buffer this value must be *true*. Default is *false*.

+ 4 - 3
docs/api/en/textures/DataTexture.html

@@ -40,7 +40,7 @@
 		const height = 512;
 		const height = 512;
 
 
 		const size = width * height;
 		const size = width * height;
-		const data = new Uint8Array( 3 * size );
+		const data = new Uint8Array( 4 * size );
 		const color = new THREE.Color( 0xffffff );
 		const color = new THREE.Color( 0xffffff );
 
 
 		const r = Math.floor( color.r * 255 );
 		const r = Math.floor( color.r * 255 );
@@ -49,17 +49,18 @@
 
 
 		for ( let i = 0; i < size; i ++ ) {
 		for ( let i = 0; i < size; i ++ ) {
 
 
-			const stride = i * 3;
+			const stride = i * 4;
 
 
 			data[ stride ] = r;
 			data[ stride ] = r;
 			data[ stride + 1 ] = g;
 			data[ stride + 1 ] = g;
 			data[ stride + 2 ] = b;
 			data[ stride + 2 ] = b;
+			data[ stride + 3 ] = 255;
 
 
 		}
 		}
 
 
 		// used the buffer to create a [name]
 		// used the buffer to create a [name]
 
 
-		const texture = new THREE.DataTexture( data, width, height, THREE.RGBFormat );
+		const texture = new THREE.DataTexture( data, width, height );
 		texture.needsUpdate = true;
 		texture.needsUpdate = true;
 		</code>
 		</code>
 
 

+ 3 - 3
docs/api/en/textures/DataTexture2DArray.html

@@ -43,7 +43,7 @@
 		const depth = 100;
 		const depth = 100;
 
 
 		const size = width * height;
 		const size = width * height;
-		const data = new Uint8Array( 3 * size * depth );
+		const data = new Uint8Array( 4 * size * depth );
 
 
 		for ( let i = 0; i < depth; i ++ ) {
 		for ( let i = 0; i < depth; i ++ ) {
 
 
@@ -54,11 +54,12 @@
 
 
 			for ( let j = 0; j < size; j ++ ) {
 			for ( let j = 0; j < size; j ++ ) {
 
 
-				const stride = ( i * size + j ) * 3;
+				const stride = ( i * size + j ) * 4;
 
 
 				data[ stride ] = r;
 				data[ stride ] = r;
 				data[ stride + 1 ] = g;
 				data[ stride + 1 ] = g;
 				data[ stride + 2 ] = b;
 				data[ stride + 2 ] = b;
+				data[ stride + 3 ] = 255;
 
 
 			}
 			}
 		}
 		}
@@ -66,7 +67,6 @@
 		// used the buffer to create a [name]
 		// used the buffer to create a [name]
 
 
 		const texture = new THREE.DataTexture2DArray( data, width, height, depth );
 		const texture = new THREE.DataTexture2DArray( data, width, height, depth );
-		texture.format = THREE.RGBFormat;
 		texture.needsUpdate = true;
 		texture.needsUpdate = true;
 		</code>
 		</code>
 
 

+ 1 - 2
docs/api/en/textures/Texture.html

@@ -117,8 +117,7 @@
 
 
 		<h3>[property:number format]</h3>
 		<h3>[property:number format]</h3>
 		<p>
 		<p>
-		The default is [page:Textures THREE.RGBAFormat], although the [page:TextureLoader TextureLoader] will automatically
-		set this to [page:Textures THREE.RGBFormat] for JPG images. <br /><br />
+		The default is [page:Textures THREE.RGBAFormat].<br /><br />
 
 
 		See the [page:Textures texture constants] page for details of other formats.
 		See the [page:Textures texture constants] page for details of other formats.
 		</p>
 		</p>

+ 1 - 1
docs/api/ko/cameras/CubeCamera.html

@@ -17,7 +17,7 @@
 
 
 		<code>
 		<code>
 		// Create cube render target
 		// Create cube render target
-		const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 128, { format: THREE.RGBFormat, generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
+		const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 128, { generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
 
 
 		// Create cube camera
 		// Create cube camera
 		const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget );
 		const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget );

+ 1 - 1
docs/api/zh/cameras/CubeCamera.html

@@ -17,7 +17,7 @@
 
 
 		<code>
 		<code>
 		// Create cube render target
 		// Create cube render target
-		const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 128, { format: THREE.RGBFormat, generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
+		const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 128, { generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
 
 
 		// Create cube camera
 		// Create cube camera
 		const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget );
 		const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget );

+ 0 - 5
docs/api/zh/materials/Material.html

@@ -107,11 +107,6 @@ Default is *false*.
 	在绘制2D叠加时,将多个事物分层在一起而不创建z-index时,禁用深度写入会很有用。
 	在绘制2D叠加时,将多个事物分层在一起而不创建z-index时,禁用深度写入会很有用。
 </p>
 </p>
 
 
-<h3>[property:Number format]</h3>
-<p>
-When this property is set to [page:Textures THREE.RGBFormat], the material is considered to be opaque and alpha values are ignored. Default is [page:Textures THREE.RGBAFormat].
-</p>
-
 <h3>[property:Boolean stencilWrite]</h3>
 <h3>[property:Boolean stencilWrite]</h3>
 <p>
 <p>
 Whether stencil operations are performed against the stencil buffer. In order to perform writes or comparisons against the stencil buffer this value must be *true*. Default is *false*.
 Whether stencil operations are performed against the stencil buffer. In order to perform writes or comparisons against the stencil buffer this value must be *true*. Default is *false*.

+ 4 - 3
docs/api/zh/textures/DataTexture.html

@@ -40,7 +40,7 @@
 		const height = 512;
 		const height = 512;
 
 
 		const size = width * height;
 		const size = width * height;
-		const data = new Uint8Array( 3 * size );
+		const data = new Uint8Array( 4 * size );
 		const color = new THREE.Color( 0xffffff );
 		const color = new THREE.Color( 0xffffff );
 
 
 		const r = Math.floor( color.r * 255 );
 		const r = Math.floor( color.r * 255 );
@@ -49,17 +49,18 @@
 
 
 		for ( let i = 0; i < size; i ++ ) {
 		for ( let i = 0; i < size; i ++ ) {
 
 
-			const stride = i * 3;
+			const stride = i * 4;
 
 
 			data[ stride ] = r;
 			data[ stride ] = r;
 			data[ stride + 1 ] = g;
 			data[ stride + 1 ] = g;
 			data[ stride + 2 ] = b;
 			data[ stride + 2 ] = b;
+			data[ stride + 3 ] = 255;
 
 
 		}
 		}
 
 
 		// used the buffer to create a [name]
 		// used the buffer to create a [name]
 
 
-		const texture = new THREE.DataTexture( data, width, height, THREE.RGBFormat );
+		const texture = new THREE.DataTexture( data, width, height );
 		texture.needsUpdate = true;
 		texture.needsUpdate = true;
 		</code>
 		</code>
 
 

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

@@ -43,7 +43,7 @@
 		const depth = 100;
 		const depth = 100;
 
 
 		const size = width * height;
 		const size = width * height;
-		const data = new Uint8Array( 3 * size * depth );
+		const data = new Uint8Array( 4 * size * depth );
 
 
 		for ( let i = 0; i < depth; i ++ ) {
 		for ( let i = 0; i < depth; i ++ ) {
 
 
@@ -54,11 +54,12 @@
 
 
 			for ( let j = 0; j < size; j ++ ) {
 			for ( let j = 0; j < size; j ++ ) {
 
 
-				const stride = ( i * size + j ) * 3;
+				const stride = ( i * size + j ) * 4;
 
 
 				data[ stride ] = r;
 				data[ stride ] = r;
 				data[ stride + 1 ] = g;
 				data[ stride + 1 ] = g;
 				data[ stride + 2 ] = b;
 				data[ stride + 2 ] = b;
+				data[ stride + 3 ] = 255;
 
 
 			}
 			}
 		}
 		}
@@ -66,7 +67,6 @@
 		// used the buffer to create a [name]
 		// used the buffer to create a [name]
 
 
 		const texture = new THREE.DataTexture2DArray( data, width, height, depth );
 		const texture = new THREE.DataTexture2DArray( data, width, height, depth );
-		texture.format = THREE.RGBFormat;
 		texture.needsUpdate = true;
 		texture.needsUpdate = true;
 		</code>
 		</code>
 
 

+ 1 - 2
docs/api/zh/textures/Texture.html

@@ -110,8 +110,7 @@
 
 
 		<h3>[property:number format]</h3>
 		<h3>[property:number format]</h3>
 		<p>
 		<p>
-		默认值为[page:Textures THREE.RGBAFormat],
-		但[page:TextureLoader TextureLoader]将会在载入JPG图片时自动将这个值设置为[page:Textures THREE.RGBFormat]。<br /><br />
+		默认值为[page:Textures THREE.RGBAFormat]。<br /><br />
 
 
 		请参阅[page:Textures texture constants]页面来了解其它格式。
 		请参阅[page:Textures texture constants]页面来了解其它格式。
 		</p>
 		</p>

+ 0 - 2
docs/scenes/material-browser.html

@@ -123,11 +123,9 @@
 				];
 				];
 
 
 				const reflectionCube = cubeTextureLoader.load( urls );
 				const reflectionCube = cubeTextureLoader.load( urls );
-				reflectionCube.format = THREE.RGBFormat;
 
 
 				const refractionCube = cubeTextureLoader.load( urls );
 				const refractionCube = cubeTextureLoader.load( urls );
 				refractionCube.mapping = THREE.CubeRefractionMapping;
 				refractionCube.mapping = THREE.CubeRefractionMapping;
-				refractionCube.format = THREE.RGBFormat;
 
 
 				return {
 				return {
 					none: null,
 					none: null,

+ 0 - 1
editor/js/libs/ui.three.js

@@ -98,7 +98,6 @@ class UITexture extends UISpan {
 
 
 						const texture = new THREE.Texture( this, mapping );
 						const texture = new THREE.Texture( this, mapping );
 						texture.sourceFile = file.name;
 						texture.sourceFile = file.name;
-						texture.format = file.type === 'image/jpeg' ? THREE.RGBFormat : THREE.RGBAFormat;
 						texture.needsUpdate = true;
 						texture.needsUpdate = true;
 
 
 						scope.setValue( texture );
 						scope.setValue( texture );

+ 1 - 3
examples/webgl_lightprobe_cubecamera.html

@@ -42,9 +42,7 @@
 				camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 1000 );
 				camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 1000 );
 				camera.position.set( 0, 0, 30 );
 				camera.position.set( 0, 0, 30 );
 
 
-				const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 256, {
-					format: THREE.RGBAFormat
-				} );
+				const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 256 );
 
 
 				cubeCamera = new THREE.CubeCamera( 1, 1000, cubeRenderTarget );
 				cubeCamera = new THREE.CubeCamera( 1, 1000, cubeRenderTarget );