MaskPass.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>MaskPass - 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">MaskPass</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This pass can be used to define a mask during post processing.
  17. Meaning only areas of subsequent post processing are affected
  18. which lie in the masking area of this pass. Internally, the masking
  19. is implemented with the stencil buffer.</p></div>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">const maskPass = new MaskPass( scene, camera );
  22. composer.addPass( maskPass );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <h2 class="subsection-title">Import</h2>
  27. <p><span translate="no">MaskPass</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>
  28. <pre><code class="language-js">import { MaskPass } from 'three/addons/postprocessing/MaskPass.js';</code></pre>
  29. <div class="container-overview">
  30. <h2>Constructor</h2>
  31. <h3 class="name name-method" id="MaskPass" translate="no">new <a href="#MaskPass">MaskPass</a><span class="signature">( scene : <span class="param-type"><a href="Scene.html">Scene</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span> )</span> </h3>
  32. <div class="method">
  33. <div class="description">
  34. <p>Constructs a new mask pass.</p>
  35. </div>
  36. <table class="params">
  37. <tbody>
  38. <tr>
  39. <td class="name">
  40. <strong>scene</strong>
  41. </td>
  42. <td class="description last">
  43. <p>The 3D objects in this scene will define the mask.</p>
  44. </td>
  45. </tr>
  46. <tr>
  47. <td class="name">
  48. <strong>camera</strong>
  49. </td>
  50. <td class="description last">
  51. <p>The camera.</p>
  52. </td>
  53. </tr>
  54. </tbody>
  55. </table>
  56. </div>
  57. </div>
  58. <h2 class="subsection-title">Properties</h2>
  59. <div class="member">
  60. <h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  61. <div class="description">
  62. <p>The camera.</p>
  63. </div>
  64. </div>
  65. <div class="member">
  66. <h3 class="name" id="clear" translate="no">.<a href="#clear">clear</a><span class="type-signature"> : boolean</span> </h3>
  67. <div class="description">
  68. <p>Overwritten to perform a clear operation by default.</p>
  69. <p>Default is <code>true</code>.</p>
  70. </div>
  71. <dl class="details">
  72. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#clear">Pass#clear</a></dt>
  73. </dl>
  74. </div>
  75. <div class="member">
  76. <h3 class="name" id="inverse" translate="no">.<a href="#inverse">inverse</a><span class="type-signature"> : boolean</span> </h3>
  77. <div class="description">
  78. <p>Whether to inverse the mask or not.</p>
  79. <p>Default is <code>false</code>.</p>
  80. </div>
  81. </div>
  82. <div class="member">
  83. <h3 class="name" id="needsSwap" translate="no">.<a href="#needsSwap">needsSwap</a><span class="type-signature"> : boolean</span> </h3>
  84. <div class="description">
  85. <p>Overwritten to disable the swap.</p>
  86. <p>Default is <code>false</code>.</p>
  87. </div>
  88. <dl class="details">
  89. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#needsSwap">Pass#needsSwap</a></dt>
  90. </dl>
  91. </div>
  92. <div class="member">
  93. <h3 class="name" id="scene" translate="no">.<a href="#scene">scene</a><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
  94. <div class="description">
  95. <p>The scene that defines the mask.</p>
  96. </div>
  97. </div>
  98. <h2 class="subsection-title">Methods</h2>
  99. <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>
  100. <div class="method">
  101. <div class="description">
  102. <p>Performs a mask pass with the configured scene and camera.</p>
  103. </div>
  104. <table class="params">
  105. <tbody>
  106. <tr>
  107. <td class="name">
  108. <strong>renderer</strong>
  109. </td>
  110. <td class="description last">
  111. <p>The renderer.</p>
  112. </td>
  113. </tr>
  114. <tr>
  115. <td class="name">
  116. <strong>writeBuffer</strong>
  117. </td>
  118. <td class="description last">
  119. <p>The write buffer. This buffer is intended as the rendering
  120. destination for the pass.</p>
  121. </td>
  122. </tr>
  123. <tr>
  124. <td class="name">
  125. <strong>readBuffer</strong>
  126. </td>
  127. <td class="description last">
  128. <p>The read buffer. The pass can access the result from the
  129. previous pass from this buffer.</p>
  130. </td>
  131. </tr>
  132. <tr>
  133. <td class="name">
  134. <strong>deltaTime</strong>
  135. </td>
  136. <td class="description last">
  137. <p>The delta time in seconds.</p>
  138. </td>
  139. </tr>
  140. <tr>
  141. <td class="name">
  142. <strong>maskActive</strong>
  143. </td>
  144. <td class="description last">
  145. <p>Whether masking is active or not.</p>
  146. </td>
  147. </tr>
  148. </tbody>
  149. </table>
  150. <dl class="details">
  151. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  152. </dl>
  153. </div>
  154. <h2 class="subsection-title">Source</h2>
  155. <p>
  156. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/MaskPass.js" translate="no" target="_blank" rel="noopener">examples/jsm/postprocessing/MaskPass.js</a>
  157. </p>
  158. </article>
  159. </section>
  160. <script src="../scripts/linenumber.js"></script>
  161. <script src="../scripts/page.js"></script>
  162. </body>
  163. </html>
粤ICP备19079148号