DepthTexture.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Texture] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. This class can be used to automatically save the depth information of a
  14. rendering into a texture.
  15. </p>
  16. <h2>Examples</h2>
  17. <p>[example:webgl_depth_texture depth / texture]</p>
  18. <h2>Constructor</h2>
  19. <h3>
  20. [name]( [param:Number width], [param:Number height], [param:Constant type],
  21. [param:Constant mapping], [param:Constant wrapS], [param:Constant wrapT],
  22. [param:Constant magFilter], [param:Constant minFilter],
  23. [param:Number anisotropy], [param:Constant format] )
  24. </h3>
  25. <p>
  26. [page:Number width] -- width of the texture.<br />
  27. [page:Number height] -- height of the texture.<br />
  28. [page:Constant type] -- Default is [page:Textures THREE.UnsignedIntType]. See [page:DepthTexture DepthTexture.type] for other choices.<br />
  29. [page:Constant mapping] -- See [page:Textures mapping mode constants] for
  30. details.<br />
  31. [page:Constant wrapS] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
  32. See [page:Textures wrap mode constants] for
  33. other choices.<br />
  34. [page:Constant wrapT] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
  35. See [page:Textures wrap mode constants] for
  36. other choices.<br />
  37. [page:Constant magFilter] -- How the texture is sampled when a texel
  38. covers more than one pixel. The default is [page:Textures THREE.NearestFilter].
  39. See [page:Textures magnification filter constants]
  40. for other choices.<br />
  41. [page:Constant minFilter] -- How the texture is sampled when a texel
  42. covers less than one pixel. The default is [page:Textures THREE.NearestFilter].
  43. See [page:Textures minification filter constants]
  44. for other choices.<br />
  45. [page:Number anisotropy] -- The number of samples taken along the axis
  46. through the pixel that has the highest density of texels. By default, this
  47. value is `1`. A higher value gives a less blurry result than a basic mipmap,
  48. at the cost of more texture samples being used. Use
  49. [page:WebGLrenderer.getMaxAnisotropy renderer.getMaxAnisotropy]() to find
  50. the maximum valid anisotropy value for the GPU; this value is usually a
  51. power of 2.<br />
  52. [page:Constant format] -- must be either [page:Textures DepthFormat]
  53. (default) or [page:Textures DepthStencilFormat]. See [page:Textures format constants] for details.<br />
  54. </p>
  55. <h2>Properties</h2>
  56. <p>
  57. See the base [page:Texture Texture] class for common properties - the
  58. following are also part of the texture class, but have different defaults
  59. here.
  60. </p>
  61. <h3>[page:Texture.format format]</h3>
  62. <p>
  63. Either [page:Textures DepthFormat] (default) or [page:Textures DepthStencilFormat].
  64. See [page:Textures format constants] for details.<br />
  65. </p>
  66. <h3>[page:Texture.type type]</h3>
  67. <p>
  68. Default is [page:Textures THREE.UnsignedIntType]. The following are options and how they map to internal
  69. gl depth format types depending on the stencil format, as well:
  70. [page:Textures THREE.UnsignedIntType] -- Uses DEPTH_COMPONENT24 or DEPTH24_STENCIL8 internally.<br />
  71. [page:Textures THREE.FloatType] -- Uses DEPTH_COMPONENT32F or DEPTH32F_STENCIL8 internally.<br />
  72. [page:Textures THREE.UnsignedShortType] -- Uses DEPTH_COMPONENT16 internally. Stencil buffer is unsupported when using this type.<br />
  73. </p>
  74. <h3>[page:Texture.magFilter magFilter]</h3>
  75. <p>
  76. How the texture is sampled when a texel covers more than one pixel. The
  77. default is [page:Textures THREE.NearestFilter]. See [page:Textures magnification filter constants] for other choices.
  78. </p>
  79. <h3>[page:Texture.minFilter minFilter]</h3>
  80. <p>
  81. How the texture is sampled when a texel covers less than one pixel. The
  82. default is [page:Textures THREE.NearestFilter]. See [page:Textures magnification filter constants]
  83. for other choices.
  84. </p>
  85. <h3>[page:Texture.flipY flipY]</h3>
  86. <p>
  87. Depth textures do not need to be flipped so this is `false` by default.
  88. </p>
  89. <h3>[page:Texture.generateMipmaps .generateMipmaps]</h3>
  90. <p>Depth textures do not use mipmaps.</p>
  91. <h3>[property:Boolean isDepthTexture]</h3>
  92. <p>Read-only flag to check if a given object is of type [name].</p>
  93. <h3>[property:number compareFunction]</h3>
  94. <p>
  95. This is used to define the comparison function used when comparing texels in the depth texture to the value in the depth buffer.
  96. Default is `null` which means comparison is disabled.<br /><br/>
  97. See the [page:Textures texture constants] page for details of other functions.
  98. </p>
  99. <h2>Methods</h2>
  100. <p>See the base [page:Texture Texture] class for common methods.</p>
  101. <h2>Source</h2>
  102. <p>
  103. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  104. </p>
  105. </body>
  106. </html>