TexturePass.html 6.8 KB

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