HalftonePass.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>HalftonePass - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="Pass.html">Pass</a> → </p>
  13. <h1 translate="no">HalftonePass</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Pass for creating a RGB halftone effect.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">const params = {
  19. shape: 1,
  20. radius: 4,
  21. rotateR: Math.PI / 12,
  22. rotateB: Math.PI / 12 * 2,
  23. rotateG: Math.PI / 12 * 3,
  24. scatter: 0,
  25. blending: 1,
  26. blendingMode: 1,
  27. greyscale: false,
  28. disable: false
  29. };
  30. const halftonePass = new HalftonePass( params );
  31. composer.addPass( halftonePass );
  32. </code></pre></div>
  33. </header>
  34. <article>
  35. <h2 class="subsection-title">Import</h2>
  36. <p><span translate="no">HalftonePass</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  37. <pre><code class="language-js">import { HalftonePass } from 'three/addons/postprocessing/HalftonePass.js';</code></pre>
  38. <div class="container-overview">
  39. <h2>Constructor</h2>
  40. <h3 class="name name-method" id="HalftonePass" translate="no">new <a href="#HalftonePass">HalftonePass</a><span class="signature">( params : <span class="param-type">Object</span> )</span> </h3>
  41. <div class="method">
  42. <div class="description">
  43. <p>Constructs a new halftone pass.</p>
  44. </div>
  45. <table class="params">
  46. <tbody>
  47. <tr>
  48. <td class="name">
  49. <strong>params</strong>
  50. </td>
  51. <td class="description last">
  52. <p>The halftone shader parameter.</p>
  53. </td>
  54. </tr>
  55. </tbody>
  56. </table>
  57. </div>
  58. </div>
  59. <h2 class="subsection-title">Properties</h2>
  60. <div class="member">
  61. <h3 class="name" id="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="ShaderMaterial.html">ShaderMaterial</a></span> </h3>
  62. <div class="description">
  63. <p>The pass material.</p>
  64. </div>
  65. </div>
  66. <div class="member">
  67. <h3 class="name" id="uniforms" translate="no">.<a href="#uniforms">uniforms</a><span class="type-signature"> : Object</span> </h3>
  68. <div class="description">
  69. <p>The pass uniforms.</p>
  70. </div>
  71. </div>
  72. <h2 class="subsection-title">Methods</h2>
  73. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  74. <div class="method">
  75. <div class="description">
  76. <p>Frees the GPU-related resources allocated by this instance. Call this
  77. method whenever the pass is no longer used in your app.</p>
  78. </div>
  79. <dl class="details">
  80. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  81. </dl>
  82. </div>
  83. <h3 class="name name-method" id="render" translate="no">.<a href="#render">render</a><span class="signature">( renderer : <span class="param-type"><a href="WebGLRenderer.html">WebGLRenderer</a></span>, writeBuffer : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span>, readBuffer : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span>, deltaTime : <span class="param-type">number</span>, maskActive : <span class="param-type">boolean</span> )</span> </h3>
  84. <div class="method">
  85. <div class="description">
  86. <p>Performs the halftone pass.</p>
  87. </div>
  88. <table class="params">
  89. <tbody>
  90. <tr>
  91. <td class="name">
  92. <strong>renderer</strong>
  93. </td>
  94. <td class="description last">
  95. <p>The renderer.</p>
  96. </td>
  97. </tr>
  98. <tr>
  99. <td class="name">
  100. <strong>writeBuffer</strong>
  101. </td>
  102. <td class="description last">
  103. <p>The write buffer. This buffer is intended as the rendering
  104. destination for the pass.</p>
  105. </td>
  106. </tr>
  107. <tr>
  108. <td class="name">
  109. <strong>readBuffer</strong>
  110. </td>
  111. <td class="description last">
  112. <p>The read buffer. The pass can access the result from the
  113. previous pass from this buffer.</p>
  114. </td>
  115. </tr>
  116. <tr>
  117. <td class="name">
  118. <strong>deltaTime</strong>
  119. </td>
  120. <td class="description last">
  121. <p>The delta time in seconds.</p>
  122. </td>
  123. </tr>
  124. <tr>
  125. <td class="name">
  126. <strong>maskActive</strong>
  127. </td>
  128. <td class="description last">
  129. <p>Whether masking is active or not.</p>
  130. </td>
  131. </tr>
  132. </tbody>
  133. </table>
  134. <dl class="details">
  135. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  136. </dl>
  137. </div>
  138. <h3 class="name name-method" id="setSize" translate="no">.<a href="#setSize">setSize</a><span class="signature">( width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
  139. <div class="method">
  140. <div class="description">
  141. <p>Sets the size of the pass.</p>
  142. </div>
  143. <table class="params">
  144. <tbody>
  145. <tr>
  146. <td class="name">
  147. <strong>width</strong>
  148. </td>
  149. <td class="description last">
  150. <p>The width to set.</p>
  151. </td>
  152. </tr>
  153. <tr>
  154. <td class="name">
  155. <strong>height</strong>
  156. </td>
  157. <td class="description last">
  158. <p>The height to set.</p>
  159. </td>
  160. </tr>
  161. </tbody>
  162. </table>
  163. <dl class="details">
  164. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  165. </dl>
  166. </div>
  167. <h2 class="subsection-title">Source</h2>
  168. <p>
  169. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/HalftonePass.js" translate="no" target="_blank" rel="noopener">examples/jsm/postprocessing/HalftonePass.js</a>
  170. </p>
  171. </article>
  172. </section>
  173. <script src="../scripts/linenumber.js"></script>
  174. <script src="../scripts/page.js"></script>
  175. </body>
  176. </html>
粤ICP备19079148号