SavePass.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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">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">WebGLRenderTarget</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"><code>renderTarget</code></td>
  37. <td class="description last"><p>The render target for saving the read buffer.
  38. If not provided, the pass automatically creates a render target.</p></td>
  39. </tr>
  40. </tbody>
  41. </table>
  42. </div>
  43. </div>
  44. <h2 class="subsection-title">Properties</h2>
  45. <div class="member">
  46. <h3 class="name" id="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="ShaderMaterial.html">ShaderMaterial</a></span> </h3>
  47. <div class="description">
  48. <p>The pass material.</p>
  49. </div>
  50. </div>
  51. <div class="member">
  52. <h3 class="name" id="needsSwap" translate="no">.<a href="#needsSwap">needsSwap</a><span class="type-signature"> : boolean</span> </h3>
  53. <div class="description">
  54. <p>Overwritten to disable the swap.<br/>Default is <code>false</code>.</p>
  55. </div>
  56. <dl class="details">
  57. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#needsSwap">Pass#needsSwap</a></dt>
  58. </dl>
  59. </div>
  60. <div class="member">
  61. <h3 class="name" id="renderTarget" translate="no">.<a href="#renderTarget">renderTarget</a><span class="type-signature"> : <a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span> </h3>
  62. <div class="description">
  63. <p>The render target which is used to save the read buffer.</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">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>
  84. <div class="method">
  85. <div class="description">
  86. <p>Performs the save pass.</p>
  87. </div>
  88. <table class="params">
  89. <tbody>
  90. <tr>
  91. <td class="name"><code>renderer</code></td>
  92. <td class="description last"><p>The renderer.</p></td>
  93. </tr>
  94. <tr>
  95. <td class="name"><code>writeBuffer</code></td>
  96. <td class="description last"><p>The write buffer. This buffer is intended as the rendering
  97. destination for the pass.</p></td>
  98. </tr>
  99. <tr>
  100. <td class="name"><code>readBuffer</code></td>
  101. <td class="description last"><p>The read buffer. The pass can access the result from the
  102. previous pass from this buffer.</p></td>
  103. </tr>
  104. <tr>
  105. <td class="name"><code>deltaTime</code></td>
  106. <td class="description last"><p>The delta time in seconds.</p></td>
  107. </tr>
  108. <tr>
  109. <td class="name"><code>maskActive</code></td>
  110. <td class="description last"><p>Whether masking is active or not.</p></td>
  111. </tr>
  112. </tbody>
  113. </table>
  114. <dl class="details">
  115. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  116. </dl>
  117. </div>
  118. <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>
  119. <div class="method">
  120. <div class="description">
  121. <p>Sets the size of the pass.</p>
  122. </div>
  123. <table class="params">
  124. <tbody>
  125. <tr>
  126. <td class="name"><code>width</code></td>
  127. <td class="description last"><p>The width to set.</p></td>
  128. </tr>
  129. <tr>
  130. <td class="name"><code>height</code></td>
  131. <td class="description last"><p>The height to set.</p></td>
  132. </tr>
  133. </tbody>
  134. </table>
  135. <dl class="details">
  136. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  137. </dl>
  138. </div>
  139. <h2 class="subsection-title">Source</h2>
  140. <p>
  141. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/SavePass.js" target="_blank" rel="noopener" translate="no">examples/jsm/postprocessing/SavePass.js</a>
  142. </p>
  143. </article>
  144. </section>
  145. <script src="../scripts/linenumber.js"></script>
  146. <script src="../scripts/page.js"></script>
  147. </body>
  148. </html>
粤ICP备19079148号