Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global: Avoid usage of RGBFormat. #23219

Merged
merged 1 commit into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api/ar/cameras/CubeCamera.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h2>مثال التعليمة البرمجية</h2>

<code>
// 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 );
Expand Down
2 changes: 1 addition & 1 deletion docs/api/en/cameras/CubeCamera.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h2>Code Example</h2>

<code>
// 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 );
Expand Down
5 changes: 0 additions & 5 deletions docs/api/en/materials/Material.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,6 @@ <h3>[property:Boolean depthWrite]</h3>
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>

<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>
<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*.
Expand Down
7 changes: 4 additions & 3 deletions docs/api/en/textures/DataTexture.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h2>Code Example</h2>
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 );
Expand All @@ -49,17 +49,18 @@ <h2>Code Example</h2>

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;
</code>

Expand Down
6 changes: 3 additions & 3 deletions docs/api/en/textures/DataTexture2DArray.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h2>Code Example</h2>
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 ++ ) {

Expand All @@ -54,19 +54,19 @@ <h2>Code Example</h2>

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;

}
}

// used the buffer to create a [name]

const texture = new THREE.DataTexture2DArray( data, width, height, depth );
texture.format = THREE.RGBFormat;
texture.needsUpdate = true;
</code>

Expand Down
3 changes: 1 addition & 2 deletions docs/api/en/textures/Texture.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ <h3>[property:number anisotropy]</h3>

<h3>[property:number format]</h3>
<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.
</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/ko/cameras/CubeCamera.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h2>코드 예제</h2>

<code>
// 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 );
Expand Down
2 changes: 1 addition & 1 deletion docs/api/zh/cameras/CubeCamera.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h2>代码示例</h2>

<code>
// 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 );
Expand Down
5 changes: 0 additions & 5 deletions docs/api/zh/materials/Material.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ <h3>[property:Boolean depthWrite]</h3>
在绘制2D叠加时,将多个事物分层在一起而不创建z-index时,禁用深度写入会很有用。
</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>
<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*.
Expand Down
7 changes: 4 additions & 3 deletions docs/api/zh/textures/DataTexture.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h2>代码示例</h2>
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 );
Expand All @@ -49,17 +49,18 @@ <h2>代码示例</h2>

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;
</code>

Expand Down
6 changes: 3 additions & 3 deletions docs/api/zh/textures/DataTexture2DArray.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h2>代码示例</h2>
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 ++ ) {

Expand All @@ -54,19 +54,19 @@ <h2>代码示例</h2>

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;

}
}

// used the buffer to create a [name]

const texture = new THREE.DataTexture2DArray( data, width, height, depth );
texture.format = THREE.RGBFormat;
texture.needsUpdate = true;
</code>

Expand Down
3 changes: 1 addition & 2 deletions docs/api/zh/textures/Texture.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ <h3>[property:number anisotropy]</h3>

<h3>[property:number format]</h3>
<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]页面来了解其它格式。
</p>
Expand Down
2 changes: 0 additions & 2 deletions docs/scenes/material-browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion editor/js/libs/ui.three.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
4 changes: 1 addition & 3 deletions examples/webgl_lightprobe_cubecamera.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down