Skip to content

Commit

Permalink
DepthTexture: change default type to UnsignedIntType when format is D…
Browse files Browse the repository at this point in the history
…epthFormat (mrdoob#24019)
  • Loading branch information
wmcmurray authored and abernier committed Sep 16, 2022
1 parent 422c819 commit 9a04d35
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/api/en/textures/DepthTexture.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h3>[name]( [param:Number width], [param:Number height], [param:Constant type],

[page:Number height] -- height of the texture.<br />

[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.<br />

[page:Constant mapping] --
Expand Down Expand Up @@ -72,7 +72,7 @@ <h3>[page:Texture.format format]</h3>

<h3>[page:Texture.type type]</h3>
<p>
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.<br />
</p>

Expand Down
4 changes: 2 additions & 2 deletions docs/api/zh/textures/DepthTexture.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h3>[name]( [param:Number width], [param:Number height], [param:Constant type],

[page:Number height] -- 纹理的高度。<br />

[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](类型常量)来了解其他选项。<br />

[page:Constant mapping] --
Expand Down Expand Up @@ -71,7 +71,7 @@ <h3>[page:Texture.format format]</h3>

<h3>[page:Texture.type type]</h3>
<p>
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]来了解详细信息。<br />
</p>

Expand Down
2 changes: 1 addition & 1 deletion src/renderers/webgl/WebGLTextures.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

}
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/webxr/WebXRManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
RGBAFormat,
sRGBEncoding,
UnsignedByteType,
UnsignedShortType,
UnsignedIntType,
UnsignedInt248Type,
} from '../../constants.js';

Expand Down Expand Up @@ -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;

}

Expand Down
6 changes: 3 additions & 3 deletions src/textures/DepthTexture.js
Original file line number Diff line number Diff line change
@@ -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 {

Expand All @@ -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 );
Expand All @@ -26,7 +26,7 @@ class DepthTexture extends Texture {
this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;

this.flipY = false;
this.generateMipmaps = false;
this.generateMipmaps = false;

}

Expand Down

0 comments on commit 9a04d35

Please sign in to comment.