WebGLRenderTarget.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <!DOCTYPE html>
  2. <html lang="zh">
  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. <h1>[name]</h1>
  11. <p class="desc">
  12. [link:https://webglfundamentals.org/webgl/lessons/webgl-render-to-texture.html render target]是一个缓冲,就是在这个缓冲中,视频卡为正在后台渲染的场景绘制像素。
  13. 它用于不同的效果,例如用于在一个图像显示在屏幕上之前先做一些处理。
  14. </p>
  15. <h2>构造器</h2>
  16. <h3>[name]([param:Number width], [param:Number height], [param:Object options])</h3>
  17. <p>
  18. [page:Float width] -renderTarget的宽度. Default is `1`.<br />
  19. [page:Float height] - renderTarget的高度. Default is `1`.<br />
  20. options - (可选)一个保存着自动生成的目标纹理的纹理参数以及表示是否使用深度缓存/模板缓存的布尔值的对象
  21. 以下是一些合法选项:<br /><br />
  22. [page:Constant wrapS] - 默认是[page:Textures ClampToEdgeWrapping]. <br />
  23. [page:Constant wrapT] - 默认是[page:Textures ClampToEdgeWrapping]. <br />
  24. [page:Constant magFilter] - 默认是[page:Textures LinearFilter]. <br />
  25. [page:Constant minFilter] - 默认是[page:Textures LinearFilter]. <br />
  26. [page:Boolean generateMipmaps] - 默认是`false`.<br />
  27. [page:Constant format] - 默认是[page:Textures RGBAFormat]. <br />
  28. [page:Constant type] - 默认是[page:Textures UnsignedByteType]. <br />
  29. [page:Number anisotropy] - 默认是`1`. 参见[page:Texture.anisotropy]<br />
  30. [page:Constant colorSpace] - 默认是[page:Textures NoColorSpace]. <br />
  31. [page:String internalFormat] - 默认是 `null`.<br />
  32. [page:Boolean depthBuffer] - 默认是`true`.<br />
  33. [page:Boolean stencilBuffer] - 默认是`false`.<br />
  34. [page:Boolean resolveDepthBuffer] - 默认是`true`.<br />
  35. [page:Boolean resolveStencilBuffer] - 默认是`true`.<br />
  36. [page:Number samples] - 默认是`0`.<br />
  37. [page:Number count] - default is `1`.<br /><br />
  38. 创建一个新[name]
  39. </p>
  40. <h2>属性</h2>
  41. <h3>[property:Boolean isWebGLRenderTarget]</h3>
  42. <p>
  43. Read-only flag to check if a given object is of type [name].
  44. </p>
  45. <h3>[property:number width]</h3>
  46. <p>
  47. 渲染目标宽度
  48. </p>
  49. <h3>[property:number height]</h3>
  50. <p>
  51. 渲染目标高度
  52. </p>
  53. <h3>[property:Vector4 scissor]</h3>
  54. <p>
  55. 渲染目标视口内的一个矩形区域,区域之外的片元将会被丢弃
  56. </p>
  57. <h3>[property:Boolean scissorTest]</h3>
  58. <p>
  59. 表明是否激活了剪裁测试
  60. </p>
  61. <h3>[property:Vector4 viewport]</h3>
  62. <p>
  63. 渲染目标的视口
  64. </p>
  65. <h3>[property:Texture texture]</h3>
  66. <p>
  67. 纹理实例保存这渲染的像素,用作进一步处理的输入值
  68. </p>
  69. <h3>[property:Texture textures]</h3>
  70. <p>
  71. An array holding the [page:WebGLRenderTarget.texture texture] references
  72. of multiple render targets configured with the [page:Number count] option.
  73. </p>
  74. <h3>[property:Boolean depthBuffer]</h3>
  75. <p>
  76. 渲染到深度缓冲区。默认true.
  77. </p>
  78. <h3>[property:Boolean stencilBuffer]</h3>
  79. <p>
  80. 渲染到模板缓冲区。默认为false.
  81. </p>
  82. <h3>[property:Boolean resolveDepthBuffer]</h3>
  83. <p>
  84. Defines whether the depth buffer should be resolved when rendering into a multisampled render target.
  85. 默认为`true`.
  86. </p>
  87. <h3>[property:Boolean resolveStencilBuffer]</h3>
  88. <p>
  89. Defines whether the stencil buffer should be resolved when rendering into a multisampled render target.
  90. This property has no effect when [page:.resolveDepthBuffer] is set to `false`.
  91. 默认为`true`.
  92. </p>
  93. <h3>[property:DepthTexture depthTexture]</h3>
  94. <p>
  95. 如果设置,那么场景的深度将会被渲染到此纹理上。默认为null
  96. </p>
  97. <h3>[property:Number samples]</h3>
  98. <p>
  99. Defines the count of MSAA samples. Default is *0*.
  100. </p>
  101. <h2>方法</h2>
  102. <h3>[method:null setSize]( [param:Number width], [param:Number height] )</h3>
  103. <p>
  104. 设置渲染目标的大小
  105. </p>
  106. <h3>[method:WebGLRenderTarget clone]()</h3>
  107. <p>
  108. 创建一个渲染目标副本
  109. </p>
  110. <h3>[method:this copy]( [param:WebGLRenderTarget source] )</h3>
  111. <p>
  112. 采用传入的渲染目标的设置
  113. </p>
  114. <h3>[method:null dispose]()</h3>
  115. <p>
  116. 发出一个处理事件
  117. </p>
  118. <h3>[page:EventDispatcher EventDispatcher]方法可从此类中获得</h3>
  119. <h2>源码</h2>
  120. <p>
  121. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  122. </p>
  123. </body>
  124. </html>