From 9a04d350632ef9e40c7982ab28f3260ddcbf287d Mon Sep 17 00:00:00 2001 From: William McMurray Date: Fri, 20 May 2022 04:09:46 -0400 Subject: [PATCH] DepthTexture: change default type to UnsignedIntType when format is DepthFormat (#24019) --- docs/api/en/textures/DepthTexture.html | 4 ++-- docs/api/zh/textures/DepthTexture.html | 4 ++-- src/renderers/webgl/WebGLTextures.js | 2 +- src/renderers/webxr/WebXRManager.js | 4 ++-- src/textures/DepthTexture.js | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/api/en/textures/DepthTexture.html b/docs/api/en/textures/DepthTexture.html index ba029ae0c6e452..aff2602a87d635 100644 --- a/docs/api/en/textures/DepthTexture.html +++ b/docs/api/en/textures/DepthTexture.html @@ -30,7 +30,7 @@

[name]( [param:Number width], [param:Number height], [param:Constant type], [page:Number height] -- height of the texture.
- [page:Constant type] -- Default is [page:Textures THREE.UnsignedShortType] when using [page:Textures DepthFormat] and [page:Textures THREE.UnsignedInt248Type] when using [page:Textures DepthStencilFormat]. + [page:Constant type] -- Default is [page:Textures THREE.UnsignedIntType] when using [page:Textures DepthFormat] and [page:Textures THREE.UnsignedInt248Type] when using [page:Textures DepthStencilFormat]. See [page:Textures type constants] for other choices.
[page:Constant mapping] -- @@ -72,7 +72,7 @@

[page:Texture.format format]

[page:Texture.type type]

- Default is [page:Textures THREE.UnsignedShortType] when using [page:Textures DepthFormat] and [page:Textures THREE.UnsignedInt248Type] when using [page:Textures DepthStencilFormat]. + Default is [page:Textures THREE.UnsignedIntType] when using [page:Textures DepthFormat] and [page:Textures THREE.UnsignedInt248Type] when using [page:Textures DepthStencilFormat]. See [page:Textures format constants] for details.

diff --git a/docs/api/zh/textures/DepthTexture.html b/docs/api/zh/textures/DepthTexture.html index 9d13441bafbfcd..c6024eb6dc043e 100644 --- a/docs/api/zh/textures/DepthTexture.html +++ b/docs/api/zh/textures/DepthTexture.html @@ -29,7 +29,7 @@

[name]( [param:Number width], [param:Number height], [param:Constant type], [page:Number height] -- 纹理的高度。
- [page:Constant type] -- Default is [page:Textures THREE.UnsignedShortType] when using [page:Textures DepthFormat] and [page:Textures THREE.UnsignedInt248Type] when using [page:Textures DepthStencilFormat]. + [page:Constant type] -- Default is [page:Textures THREE.UnsignedIntType] when using [page:Textures DepthFormat] and [page:Textures THREE.UnsignedInt248Type] when using [page:Textures DepthStencilFormat]. 请参阅[page:Textures type constants](类型常量)来了解其他选项。
[page:Constant mapping] -- @@ -71,7 +71,7 @@

[page:Texture.format format]

[page:Texture.type type]

- Default is [page:Textures THREE.UnsignedShortType] when using [page:Textures DepthFormat] and [page:Textures THREE.UnsignedInt248Type] when using [page:Textures DepthStencilFormat]. + Default is [page:Textures THREE.UnsignedIntType] when using [page:Textures DepthFormat] and [page:Textures THREE.UnsignedInt248Type] when using [page:Textures DepthStencilFormat]. 请参阅[page:Textures format constants]来了解详细信息。

diff --git a/src/renderers/webgl/WebGLTextures.js b/src/renderers/webgl/WebGLTextures.js index 36b88ae03d818e..fa08e1a33e31d1 100644 --- a/src/renderers/webgl/WebGLTextures.js +++ b/src/renderers/webgl/WebGLTextures.js @@ -747,7 +747,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, console.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' ); - texture.type = UnsignedShortType; + texture.type = UnsignedIntType; glType = utils.convert( texture.type ); } diff --git a/src/renderers/webxr/WebXRManager.js b/src/renderers/webxr/WebXRManager.js index 895106521749c7..5745cfcf1730be 100644 --- a/src/renderers/webxr/WebXRManager.js +++ b/src/renderers/webxr/WebXRManager.js @@ -13,7 +13,7 @@ import { RGBAFormat, sRGBEncoding, UnsignedByteType, - UnsignedShortType, + UnsignedIntType, UnsignedInt248Type, } from '../../constants.js'; @@ -292,7 +292,7 @@ class WebXRManager extends EventDispatcher { glDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24; depthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat; - depthType = attributes.stencil ? UnsignedInt248Type : UnsignedShortType; + depthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType; } diff --git a/src/textures/DepthTexture.js b/src/textures/DepthTexture.js index fba1630fd33261..59fcf0aacbea12 100644 --- a/src/textures/DepthTexture.js +++ b/src/textures/DepthTexture.js @@ -1,5 +1,5 @@ import { Texture } from './Texture.js'; -import { NearestFilter, UnsignedShortType, UnsignedInt248Type, DepthFormat, DepthStencilFormat } from '../constants.js'; +import { NearestFilter, UnsignedIntType, UnsignedInt248Type, DepthFormat, DepthStencilFormat } from '../constants.js'; class DepthTexture extends Texture { @@ -13,7 +13,7 @@ class DepthTexture extends Texture { } - if ( type === undefined && format === DepthFormat ) type = UnsignedShortType; + if ( type === undefined && format === DepthFormat ) type = UnsignedIntType; if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type; super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); @@ -26,7 +26,7 @@ class DepthTexture extends Texture { this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; this.flipY = false; - this.generateMipmaps = false; + this.generateMipmaps = false; }