Texture

深度纹理(DepthTexture)

This class can be used to automatically save the depth information of a rendering into a texture. When using a WebGL 1 rendering context, DepthTexture requires support for the WEBGL_depth_texture extension.

例子

depth / texture

构造函数

DepthTexture(width : Number, height : Number, type : Constant, wrapS : Constant, wrapT : Constant, magFilter : Constant, minFilter : Constant, anisotropy : Number, format : Constant)

width -- 纹理的宽度。
height -- 纹理的高度。
type -- Default is v3d.UnsignedShortType when unsing DepthFormat and v3d.UnsignedInt248Type when using DepthStencilFormat. 请参阅type constants(类型常量)来了解其他选项。
mapping -- 请参阅mapping mode constants(映射模式常量)来了解其他选项。
wrapS -- 默认值是v3d.ClampToEdgeWrapping. 请参阅wrap mode constants(包裹模式常量)来了解其他选项。
wrapT -- 默认值是v3d.ClampToEdgeWrapping. 请参阅wrap mode constants(包裹模式常量)来了解其他选项。
magFilter -- 当一个纹素覆盖大于一个像素时,贴图将如何采样。 其默认值为v3d.LinearFilter。请参阅magnification filter constants(放大滤镜常量)来了解其它选项。
minFilter -- 当一个纹素覆盖小于一个像素时,贴图将如何采样。 其默认值为v3d.LinearMipMapLinearFilter。请参阅minification filter constants(缩小滤镜常量)来了解其它选项。
anisotropy -- 沿着轴,通过具有最高纹素密度的像素的样本数。 默认情况下,这个值为1。设置一个较高的值将会产生比基本的mipmap更清晰的效果,代价是需要使用更多纹理样本。 使用renderer.getMaxAnisotropy() 来查询GPU中各向异性的最大有效值;这个值通常是2的幂。

format -- 这个值必须是DepthFormat(默认值)或者DepthStencilFormat。 请参阅format constants(格式常量)来了解详细信息。

属性

共有属性请参见其基类Texture。 —— 以下属性也是texture类中的一部分,但在这里默认值不同。

.format

DepthFormat(默认值)或者DepthStencilFormat中的一个。 请参阅format constants来了解详细信息。

.type

Default is v3d.UnsignedShortType when unsing DepthFormat and v3d.UnsignedInt248Type when using DepthStencilFormat. 请参阅format constants来了解详细信息。

.magFilter

当一个纹素覆盖大于一个像素时,贴图将如何采样。 其默认值为v3d.NearestFilter。 请参阅magnification filter constants(放大滤镜常量)来了解其他选项。

.minFilter

当一个纹素覆盖小于一个像素时,贴图将如何采样。 其默认值为v3d.NearestFilter。 请参阅minification filter constants(缩小滤镜常量)来了解其他选项。

.flipY

深度贴图不需要被翻转,因此其默认值为false

.generateMipmaps

深度贴图不使用mipmap。

方法

共有方法请参见其基类Texture

源代码

src/textures/DepthTexture.js