SavePass.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SavePass - 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">SavePass</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A pass that saves the contents of the current read buffer in a render target.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">const savePass = new SavePass( customRenderTarget );
  19. composer.addPass( savePass );
  20. </code></pre></div>
  21. </header>
  22. <article>
  23. <h2 class="subsection-title">Import</h2>
  24. <p><span translate="no">SavePass</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>
  25. <pre><code class="language-js">import { SavePass } from 'three/addons/postprocessing/SavePass.js';</code></pre>
  26. <div class="container-overview">
  27. <h2>Constructor</h2>
  28. <h3 class="name name-method" id="SavePass" translate="no">new <a href="#SavePass">SavePass</a><span class="signature">( renderTarget : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span> )</span> </h3>
  29. <div class="method">
  30. <div class="description">
  31. <p>Constructs a new save pass.</p>
  32. </div>
  33. <table class="params">
  34. <tbody>
  35. <tr>
  36. <td class="name">
  37. <strong>renderTarget</strong>
  38. </td>
  39. <td class="description last">
  40. <p>The render target for saving the read buffer.
  41. If not provided, the pass automatically creates a render target.</p>
  42. </td>
  43. </tr>
  44. </tbody>
  45. </table>
  46. </div>
  47. </div>
  48. <h2 class="subsection-title">Properties</h2>
  49. <div class="member">
  50. <h3 class="name" id="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="ShaderMaterial.html">ShaderMaterial</a></span> </h3>
  51. <div class="description">
  52. <p>The pass material.</p>
  53. </div>
  54. </div>
  55. <div class="member">
  56. <h3 class="name" id="needsSwap" translate="no">.<a href="#needsSwap">needsSwap</a><span class="type-signature"> : boolean</span> </h3>
  57. <div class="description">
  58. <p>Overwritten to disable the swap.</p>
  59. <p>Default is <code>false</code>.</p>
  60. </div>
  61. <dl class="details">
  62. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#needsSwap">Pass#needsSwap</a></dt>
  63. </dl>
  64. </div>
  65. <div class="member">
  66. <h3 class="name" id="renderTarget" translate="no">.<a href="#renderTarget">renderTarget</a><span class="type-signature"> : <a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span> </h3>
  67. <div class="description">
  68. <p>The render target which is used to save the read buffer.</p>
  69. </div>
  70. </div>
  71. <div class="member">
  72. <h3 class="name" id="uniforms" translate="no">.<a href="#uniforms">uniforms</a><span class="type-signature"> : Object</span> </h3>
  73. <div class="description">
  74. <p>The pass uniforms.</p>
  75. </div>
  76. </div>
  77. <h2 class="subsection-title">Methods</h2>
  78. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  79. <div class="method">
  80. <div class="description">
  81. <p>Frees the GPU-related resources allocated by this instance. Call this
  82. method whenever the pass is no longer used in your app.</p>
  83. </div>
  84. <dl class="details">
  85. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  86. </dl>
  87. </div>
  88. <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>
  89. <div class="method">
  90. <div class="description">
  91. <p>Performs the save pass.</p>
  92. </div>
  93. <table class="params">
  94. <tbody>
  95. <tr>
  96. <td class="name">
  97. <strong>renderer</strong>
  98. </td>
  99. <td class="description last">
  100. <p>The renderer.</p>
  101. </td>
  102. </tr>
  103. <tr>
  104. <td class="name">
  105. <strong>writeBuffer</strong>
  106. </td>
  107. <td class="description last">
  108. <p>The write buffer. This buffer is intended as the rendering
  109. destination for the pass.</p>
  110. </td>
  111. </tr>
  112. <tr>
  113. <td class="name">
  114. <strong>readBuffer</strong>
  115. </td>
  116. <td class="description last">
  117. <p>The read buffer. The pass can access the result from the
  118. previous pass from this buffer.</p>
  119. </td>
  120. </tr>
  121. <tr>
  122. <td class="name">
  123. <strong>deltaTime</strong>
  124. </td>
  125. <td class="description last">
  126. <p>The delta time in seconds.</p>
  127. </td>
  128. </tr>
  129. <tr>
  130. <td class="name">
  131. <strong>maskActive</strong>
  132. </td>
  133. <td class="description last">
  134. <p>Whether masking is active or not.</p>
  135. </td>
  136. </tr>
  137. </tbody>
  138. </table>
  139. <dl class="details">
  140. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  141. </dl>
  142. </div>
  143. <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>
  144. <div class="method">
  145. <div class="description">
  146. <p>Sets the size of the pass.</p>
  147. </div>
  148. <table class="params">
  149. <tbody>
  150. <tr>
  151. <td class="name">
  152. <strong>width</strong>
  153. </td>
  154. <td class="description last">
  155. <p>The width to set.</p>
  156. </td>
  157. </tr>
  158. <tr>
  159. <td class="name">
  160. <strong>height</strong>
  161. </td>
  162. <td class="description last">
  163. <p>The height to set.</p>
  164. </td>
  165. </tr>
  166. </tbody>
  167. </table>
  168. <dl class="details">
  169. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  170. </dl>
  171. </div>
  172. <h2 class="subsection-title">Source</h2>
  173. <p>
  174. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/SavePass.js" translate="no" target="_blank" rel="noopener">examples/jsm/postprocessing/SavePass.js</a>
  175. </p>
  176. </article>
  177. </section>
  178. <script src="../scripts/linenumber.js"></script>
  179. <script src="../scripts/page.js"></script>
  180. </body>
  181. </html>
粤ICP备19079148号