TexturePass.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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">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">Texture</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"><code>map</code></td>
  39. <td class="description last"><p>The texture to render.</p></td>
  40. </tr>
  41. <tr>
  42. <td class="name"><code>opacity</code></td>
  43. <td class="description last"><p>The opacity.<br/>Default is <code>1</code>.</p></td>
  44. </tr>
  45. </tbody>
  46. </table>
  47. </div>
  48. </div>
  49. <h2 class="subsection-title">Properties</h2>
  50. <div class="member">
  51. <h3 class="name" id="map" translate="no">.<a href="#map">map</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  52. <div class="description">
  53. <p>The texture to render.</p>
  54. </div>
  55. </div>
  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="needsSwap" translate="no">.<a href="#needsSwap">needsSwap</a><span class="type-signature"> : boolean</span> </h3>
  64. <div class="description">
  65. <p>Overwritten to disable the swap.<br/>Default is <code>false</code>.</p>
  66. </div>
  67. <dl class="details">
  68. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#needsSwap">Pass#needsSwap</a></dt>
  69. </dl>
  70. </div>
  71. <div class="member">
  72. <h3 class="name" id="opacity" translate="no">.<a href="#opacity">opacity</a><span class="type-signature"> : number</span> </h3>
  73. <div class="description">
  74. <p>The opacity.<br/>Default is <code>1</code>.</p>
  75. </div>
  76. </div>
  77. <div class="member">
  78. <h3 class="name" id="uniforms" translate="no">.<a href="#uniforms">uniforms</a><span class="type-signature"> : Object</span> </h3>
  79. <div class="description">
  80. <p>The pass uniforms.</p>
  81. </div>
  82. </div>
  83. <h2 class="subsection-title">Methods</h2>
  84. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  85. <div class="method">
  86. <div class="description">
  87. <p>Frees the GPU-related resources allocated by this instance. Call this
  88. method whenever the pass is no longer used in your app.</p>
  89. </div>
  90. <dl class="details">
  91. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  92. </dl>
  93. </div>
  94. <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>
  95. <div class="method">
  96. <div class="description">
  97. <p>Performs the texture pass.</p>
  98. </div>
  99. <table class="params">
  100. <tbody>
  101. <tr>
  102. <td class="name"><code>renderer</code></td>
  103. <td class="description last"><p>The renderer.</p></td>
  104. </tr>
  105. <tr>
  106. <td class="name"><code>writeBuffer</code></td>
  107. <td class="description last"><p>The write buffer. This buffer is intended as the rendering
  108. destination for the pass.</p></td>
  109. </tr>
  110. <tr>
  111. <td class="name"><code>readBuffer</code></td>
  112. <td class="description last"><p>The read buffer. The pass can access the result from the
  113. previous pass from this buffer.</p></td>
  114. </tr>
  115. <tr>
  116. <td class="name"><code>deltaTime</code></td>
  117. <td class="description last"><p>The delta time in seconds.</p></td>
  118. </tr>
  119. <tr>
  120. <td class="name"><code>maskActive</code></td>
  121. <td class="description last"><p>Whether masking is active or not.</p></td>
  122. </tr>
  123. </tbody>
  124. </table>
  125. <dl class="details">
  126. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  127. </dl>
  128. </div>
  129. <h2 class="subsection-title">Source</h2>
  130. <p>
  131. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/TexturePass.js" target="_blank" rel="noopener" translate="no">examples/jsm/postprocessing/TexturePass.js</a>
  132. </p>
  133. </article>
  134. </section>
  135. <script src="../scripts/linenumber.js"></script>
  136. <script src="../scripts/page.js"></script>
  137. </body>
  138. </html>
粤ICP备19079148号