HalftonePass.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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">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"><code>params</code></td>
  49. <td class="description last"><p>The halftone shader parameter.</p></td>
  50. </tr>
  51. </tbody>
  52. </table>
  53. </div>
  54. </div>
  55. <h2 class="subsection-title">Properties</h2>
  56. <div class="member">
  57. <h3 class="name" id="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="ShaderMaterial.html">ShaderMaterial</a></span> </h3>
  58. <div class="description">
  59. <p>The pass material.</p>
  60. </div>
  61. </div>
  62. <div class="member">
  63. <h3 class="name" id="uniforms" translate="no">.<a href="#uniforms">uniforms</a><span class="type-signature"> : Object</span> </h3>
  64. <div class="description">
  65. <p>The pass uniforms.</p>
  66. </div>
  67. </div>
  68. <h2 class="subsection-title">Methods</h2>
  69. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  70. <div class="method">
  71. <div class="description">
  72. <p>Frees the GPU-related resources allocated by this instance. Call this
  73. method whenever the pass is no longer used in your app.</p>
  74. </div>
  75. <dl class="details">
  76. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  77. </dl>
  78. </div>
  79. <h3 class="name name-method" id="render" translate="no">.<a href="#render">render</a><span class="signature">( renderer : <span class="param-type">WebGLRenderer</span>, writeBuffer : <span class="param-type">WebGLRenderTarget</span>, readBuffer : <span class="param-type">WebGLRenderTarget</span>, deltaTime : <span class="param-type">number</span>, maskActive : <span class="param-type">boolean</span> )</span> </h3>
  80. <div class="method">
  81. <div class="description">
  82. <p>Performs the halftone pass.</p>
  83. </div>
  84. <table class="params">
  85. <tbody>
  86. <tr>
  87. <td class="name"><code>renderer</code></td>
  88. <td class="description last"><p>The renderer.</p></td>
  89. </tr>
  90. <tr>
  91. <td class="name"><code>writeBuffer</code></td>
  92. <td class="description last"><p>The write buffer. This buffer is intended as the rendering
  93. destination for the pass.</p></td>
  94. </tr>
  95. <tr>
  96. <td class="name"><code>readBuffer</code></td>
  97. <td class="description last"><p>The read buffer. The pass can access the result from the
  98. previous pass from this buffer.</p></td>
  99. </tr>
  100. <tr>
  101. <td class="name"><code>deltaTime</code></td>
  102. <td class="description last"><p>The delta time in seconds.</p></td>
  103. </tr>
  104. <tr>
  105. <td class="name"><code>maskActive</code></td>
  106. <td class="description last"><p>Whether masking is active or not.</p></td>
  107. </tr>
  108. </tbody>
  109. </table>
  110. <dl class="details">
  111. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  112. </dl>
  113. </div>
  114. <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>
  115. <div class="method">
  116. <div class="description">
  117. <p>Sets the size of the pass.</p>
  118. </div>
  119. <table class="params">
  120. <tbody>
  121. <tr>
  122. <td class="name"><code>width</code></td>
  123. <td class="description last"><p>The width to set.</p></td>
  124. </tr>
  125. <tr>
  126. <td class="name"><code>height</code></td>
  127. <td class="description last"><p>The height to set.</p></td>
  128. </tr>
  129. </tbody>
  130. </table>
  131. <dl class="details">
  132. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  133. </dl>
  134. </div>
  135. <h2 class="subsection-title">Source</h2>
  136. <p>
  137. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/HalftonePass.js" target="_blank" rel="noopener" translate="no">examples/jsm/postprocessing/HalftonePass.js</a>
  138. </p>
  139. </article>
  140. </section>
  141. <script src="../scripts/linenumber.js"></script>
  142. <script src="../scripts/page.js"></script>
  143. </body>
  144. </html>
粤ICP备19079148号