From 7cc394ffb538c7927cff6b28a77f6e3fa6cd8ccb Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Thu, 13 Jan 2022 10:09:38 +0100 Subject: [PATCH] Global: Avoid usage of RGBFormat. --- docs/api/ar/cameras/CubeCamera.html | 2 +- docs/api/en/cameras/CubeCamera.html | 2 +- docs/api/en/materials/Material.html | 5 ----- docs/api/en/textures/DataTexture.html | 7 ++++--- docs/api/en/textures/DataTexture2DArray.html | 6 +++--- docs/api/en/textures/Texture.html | 3 +-- docs/api/ko/cameras/CubeCamera.html | 2 +- docs/api/zh/cameras/CubeCamera.html | 2 +- docs/api/zh/materials/Material.html | 5 ----- docs/api/zh/textures/DataTexture.html | 7 ++++--- docs/api/zh/textures/DataTexture2DArray.html | 6 +++--- docs/api/zh/textures/Texture.html | 3 +-- docs/scenes/material-browser.html | 2 -- editor/js/libs/ui.three.js | 1 - examples/webgl_lightprobe_cubecamera.html | 4 +--- 15 files changed, 21 insertions(+), 36 deletions(-) diff --git a/docs/api/ar/cameras/CubeCamera.html b/docs/api/ar/cameras/CubeCamera.html index 220ec9b197ee96..351b5564333b00 100644 --- a/docs/api/ar/cameras/CubeCamera.html +++ b/docs/api/ar/cameras/CubeCamera.html @@ -17,7 +17,7 @@

مثال التعليمة البرمجية

// 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 const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget ); diff --git a/docs/api/en/cameras/CubeCamera.html b/docs/api/en/cameras/CubeCamera.html index 10f37354d2cc1e..884ccb796b90c0 100644 --- a/docs/api/en/cameras/CubeCamera.html +++ b/docs/api/en/cameras/CubeCamera.html @@ -17,7 +17,7 @@

Code Example

// 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 const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget ); diff --git a/docs/api/en/materials/Material.html b/docs/api/en/materials/Material.html index aafcdc6f6374a5..6ccdab1672467d 100644 --- a/docs/api/en/materials/Material.html +++ b/docs/api/en/materials/Material.html @@ -128,11 +128,6 @@

[property:Boolean depthWrite]

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.

-

[property:Number format]

-

- 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]. -

-

[property:Boolean stencilWrite]

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*. diff --git a/docs/api/en/textures/DataTexture.html b/docs/api/en/textures/DataTexture.html index d621a206f818fb..d54a8ce529a407 100644 --- a/docs/api/en/textures/DataTexture.html +++ b/docs/api/en/textures/DataTexture.html @@ -40,7 +40,7 @@

Code Example

const height = 512; const size = width * height; - const data = new Uint8Array( 3 * size ); + const data = new Uint8Array( 4 * size ); const color = new THREE.Color( 0xffffff ); const r = Math.floor( color.r * 255 ); @@ -49,17 +49,18 @@

Code Example

for ( let i = 0; i < size; i ++ ) { - const stride = i * 3; + const stride = i * 4; data[ stride ] = r; data[ stride + 1 ] = g; data[ stride + 2 ] = b; + data[ stride + 3 ] = 255; } // 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;
diff --git a/docs/api/en/textures/DataTexture2DArray.html b/docs/api/en/textures/DataTexture2DArray.html index 7ac884a7c32abe..8e1412349330ce 100644 --- a/docs/api/en/textures/DataTexture2DArray.html +++ b/docs/api/en/textures/DataTexture2DArray.html @@ -43,7 +43,7 @@

Code Example

const depth = 100; 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 ++ ) { @@ -54,11 +54,12 @@

Code Example

for ( let j = 0; j < size; j ++ ) { - const stride = ( i * size + j ) * 3; + const stride = ( i * size + j ) * 4; data[ stride ] = r; data[ stride + 1 ] = g; data[ stride + 2 ] = b; + data[ stride + 3 ] = 255; } } @@ -66,7 +67,6 @@

Code Example

// used the buffer to create a [name] const texture = new THREE.DataTexture2DArray( data, width, height, depth ); - texture.format = THREE.RGBFormat; texture.needsUpdate = true;
diff --git a/docs/api/en/textures/Texture.html b/docs/api/en/textures/Texture.html index fa96149791edc9..1e966d796e4975 100644 --- a/docs/api/en/textures/Texture.html +++ b/docs/api/en/textures/Texture.html @@ -117,8 +117,7 @@

[property:number anisotropy]

[property:number format]

- The default is [page:Textures THREE.RGBAFormat], although the [page:TextureLoader TextureLoader] will automatically - set this to [page:Textures THREE.RGBFormat] for JPG images.

+ The default is [page:Textures THREE.RGBAFormat].

See the [page:Textures texture constants] page for details of other formats.

diff --git a/docs/api/ko/cameras/CubeCamera.html b/docs/api/ko/cameras/CubeCamera.html index b3857661e43ebf..6c986cda65be06 100644 --- a/docs/api/ko/cameras/CubeCamera.html +++ b/docs/api/ko/cameras/CubeCamera.html @@ -17,7 +17,7 @@

코드 예제

// 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 const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget ); diff --git a/docs/api/zh/cameras/CubeCamera.html b/docs/api/zh/cameras/CubeCamera.html index 79f79d2376ddfc..dc6b683342135d 100644 --- a/docs/api/zh/cameras/CubeCamera.html +++ b/docs/api/zh/cameras/CubeCamera.html @@ -17,7 +17,7 @@

代码示例

// 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 const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget ); diff --git a/docs/api/zh/materials/Material.html b/docs/api/zh/materials/Material.html index 1312e7f86460f1..2fc04c98848b75 100644 --- a/docs/api/zh/materials/Material.html +++ b/docs/api/zh/materials/Material.html @@ -107,11 +107,6 @@

[property:Boolean depthWrite]

在绘制2D叠加时,将多个事物分层在一起而不创建z-index时,禁用深度写入会很有用。

-

[property:Number format]

-

-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]. -

-

[property:Boolean stencilWrite]

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*. diff --git a/docs/api/zh/textures/DataTexture.html b/docs/api/zh/textures/DataTexture.html index c75cd9015b234f..d0f6aef2962b68 100644 --- a/docs/api/zh/textures/DataTexture.html +++ b/docs/api/zh/textures/DataTexture.html @@ -40,7 +40,7 @@

代码示例

const height = 512; const size = width * height; - const data = new Uint8Array( 3 * size ); + const data = new Uint8Array( 4 * size ); const color = new THREE.Color( 0xffffff ); const r = Math.floor( color.r * 255 ); @@ -49,17 +49,18 @@

代码示例

for ( let i = 0; i < size; i ++ ) { - const stride = i * 3; + const stride = i * 4; data[ stride ] = r; data[ stride + 1 ] = g; data[ stride + 2 ] = b; + data[ stride + 3 ] = 255; } // 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;
diff --git a/docs/api/zh/textures/DataTexture2DArray.html b/docs/api/zh/textures/DataTexture2DArray.html index bfeb569fa6d303..bd40b681869519 100644 --- a/docs/api/zh/textures/DataTexture2DArray.html +++ b/docs/api/zh/textures/DataTexture2DArray.html @@ -43,7 +43,7 @@

代码示例

const depth = 100; 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 ++ ) { @@ -54,11 +54,12 @@

代码示例

for ( let j = 0; j < size; j ++ ) { - const stride = ( i * size + j ) * 3; + const stride = ( i * size + j ) * 4; data[ stride ] = r; data[ stride + 1 ] = g; data[ stride + 2 ] = b; + data[ stride + 3 ] = 255; } } @@ -66,7 +67,6 @@

代码示例

// used the buffer to create a [name] const texture = new THREE.DataTexture2DArray( data, width, height, depth ); - texture.format = THREE.RGBFormat; texture.needsUpdate = true;
diff --git a/docs/api/zh/textures/Texture.html b/docs/api/zh/textures/Texture.html index 2a72f530b7f795..79564c296c79f7 100644 --- a/docs/api/zh/textures/Texture.html +++ b/docs/api/zh/textures/Texture.html @@ -110,8 +110,7 @@

[property:number anisotropy]

[property:number format]

- 默认值为[page:Textures THREE.RGBAFormat], - 但[page:TextureLoader TextureLoader]将会在载入JPG图片时自动将这个值设置为[page:Textures THREE.RGBFormat]。

+ 默认值为[page:Textures THREE.RGBAFormat]。

请参阅[page:Textures texture constants]页面来了解其它格式。

diff --git a/docs/scenes/material-browser.html b/docs/scenes/material-browser.html index 5816d92375b4a5..75e30ce9c6dd54 100644 --- a/docs/scenes/material-browser.html +++ b/docs/scenes/material-browser.html @@ -123,11 +123,9 @@ ]; const reflectionCube = cubeTextureLoader.load( urls ); - reflectionCube.format = THREE.RGBFormat; const refractionCube = cubeTextureLoader.load( urls ); refractionCube.mapping = THREE.CubeRefractionMapping; - refractionCube.format = THREE.RGBFormat; return { none: null, diff --git a/editor/js/libs/ui.three.js b/editor/js/libs/ui.three.js index a2460788fd557a..50a3d4e0af0574 100644 --- a/editor/js/libs/ui.three.js +++ b/editor/js/libs/ui.three.js @@ -98,7 +98,6 @@ class UITexture extends UISpan { const texture = new THREE.Texture( this, mapping ); texture.sourceFile = file.name; - texture.format = file.type === 'image/jpeg' ? THREE.RGBFormat : THREE.RGBAFormat; texture.needsUpdate = true; scope.setValue( texture ); diff --git a/examples/webgl_lightprobe_cubecamera.html b/examples/webgl_lightprobe_cubecamera.html index 4de9d5a61cff75..828da5cb3b66ee 100644 --- a/examples/webgl_lightprobe_cubecamera.html +++ b/examples/webgl_lightprobe_cubecamera.html @@ -42,9 +42,7 @@ camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 1000 ); 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 );