OutlinePass.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>OutlinePass - 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">OutlinePass</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A pass for rendering outlines around selected objects.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">const resolution = new THREE.Vector2( window.innerWidth, window.innerHeight );
  19. const outlinePass = new OutlinePass( resolution, scene, camera );
  20. composer.addPass( outlinePass );
  21. </code></pre></div>
  22. </header>
  23. <article>
  24. <h2 class="subsection-title">Import</h2>
  25. <p><span translate="no">OutlinePass</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  26. <pre><code class="language-js">import { OutlinePass } from 'three/addons/postprocessing/OutlinePass.js';</code></pre>
  27. <div class="container-overview">
  28. <h2>Constructor</h2>
  29. <h3 class="name name-method" id="OutlinePass" translate="no">new <a href="#OutlinePass">OutlinePass</a><span class="signature">( resolution : <span class="param-type">Vector2</span>, scene : <span class="param-type">Scene</span>, camera : <span class="param-type">Camera</span>, selectedObjects : <span class="param-type">Array.&lt;Object3D></span> )</span> </h3>
  30. <div class="method">
  31. <div class="description">
  32. <p>Constructs a new outline pass.</p>
  33. </div>
  34. <table class="params">
  35. <tbody>
  36. <tr>
  37. <td class="name"><code>resolution</code></td>
  38. <td class="description last"><p>The effect's resolution.</p></td>
  39. </tr>
  40. <tr>
  41. <td class="name"><code>scene</code></td>
  42. <td class="description last"><p>The scene to render.</p></td>
  43. </tr>
  44. <tr>
  45. <td class="name"><code>camera</code></td>
  46. <td class="description last"><p>The camera.</p></td>
  47. </tr>
  48. <tr>
  49. <td class="name"><code>selectedObjects</code></td>
  50. <td class="description last"><p>The selected 3D objects that should receive an outline.</p></td>
  51. </tr>
  52. </tbody>
  53. </table>
  54. </div>
  55. </div>
  56. <h2 class="subsection-title">Properties</h2>
  57. <div class="member">
  58. <h3 class="name" id="downSampleRatio" translate="no">.<a href="#downSampleRatio">downSampleRatio</a><span class="type-signature"> : number</span> </h3>
  59. <div class="description">
  60. <p>The downsample ratio. The effect can be rendered in a much
  61. lower resolution than the beauty pass.<br/>Default is <code>2</code>.</p>
  62. </div>
  63. </div>
  64. <div class="member">
  65. <h3 class="name" id="edgeGlow" translate="no">.<a href="#edgeGlow">edgeGlow</a><span class="type-signature"> : number</span> </h3>
  66. <div class="description">
  67. <p>Can be used for an animated glow/pulse effect.<br/>Default is <code>0</code>.</p>
  68. </div>
  69. </div>
  70. <div class="member">
  71. <h3 class="name" id="edgeStrength" translate="no">.<a href="#edgeStrength">edgeStrength</a><span class="type-signature"> : number</span> </h3>
  72. <div class="description">
  73. <p>The edge strength.<br/>Default is <code>3</code>.</p>
  74. </div>
  75. </div>
  76. <div class="member">
  77. <h3 class="name" id="edgeThickness" translate="no">.<a href="#edgeThickness">edgeThickness</a><span class="type-signature"> : number</span> </h3>
  78. <div class="description">
  79. <p>The edge thickness.<br/>Default is <code>1</code>.</p>
  80. </div>
  81. </div>
  82. <div class="member">
  83. <h3 class="name" id="hiddenEdgeColor" translate="no">.<a href="#hiddenEdgeColor">hiddenEdgeColor</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  84. <div class="description">
  85. <p>The hidden edge color.<br/>Default is <code>(0.1,0.04,0.02)</code>.</p>
  86. </div>
  87. </div>
  88. <div class="member">
  89. <h3 class="name" id="patternTexture" translate="no">.<a href="#patternTexture">patternTexture</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  90. <div class="description">
  91. <p>Can be used to highlight selected 3D objects. Requires to set
  92. <a href="OutlinePass.html#usePatternTexture">OutlinePass#usePatternTexture</a> to <code>true</code>.<br/>Default is <code>null</code>.</p>
  93. </div>
  94. </div>
  95. <div class="member">
  96. <h3 class="name" id="pulsePeriod" translate="no">.<a href="#pulsePeriod">pulsePeriod</a><span class="type-signature"> : number</span> </h3>
  97. <div class="description">
  98. <p>The pulse period.<br/>Default is <code>0</code>.</p>
  99. </div>
  100. </div>
  101. <div class="member">
  102. <h3 class="name" id="renderCamera" translate="no">.<a href="#renderCamera">renderCamera</a><span class="type-signature"> : Object</span> </h3>
  103. <div class="description">
  104. <p>The camera.</p>
  105. </div>
  106. </div>
  107. <div class="member">
  108. <h3 class="name" id="renderScene" translate="no">.<a href="#renderScene">renderScene</a><span class="type-signature"> : Object</span> </h3>
  109. <div class="description">
  110. <p>The scene to render.</p>
  111. </div>
  112. </div>
  113. <div class="member">
  114. <h3 class="name" id="resolution" translate="no">.<a href="#resolution">resolution</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  115. <div class="description">
  116. <p>The effect's resolution.<br/>Default is <code>(256,256)</code>.</p>
  117. </div>
  118. </div>
  119. <div class="member">
  120. <h3 class="name" id="selectedObjects" translate="no">.<a href="#selectedObjects">selectedObjects</a><span class="type-signature"> : Array.&lt;<a href="Object3D.html">Object3D</a>></span> </h3>
  121. <div class="description">
  122. <p>The selected 3D objects that should receive an outline.</p>
  123. </div>
  124. </div>
  125. <div class="member">
  126. <h3 class="name" id="usePatternTexture" translate="no">.<a href="#usePatternTexture">usePatternTexture</a><span class="type-signature"> : boolean</span> </h3>
  127. <div class="description">
  128. <p>Whether to use a pattern texture for to highlight selected
  129. 3D objects or not.<br/>Default is <code>false</code>.</p>
  130. </div>
  131. </div>
  132. <div class="member">
  133. <h3 class="name" id="visibleEdgeColor" translate="no">.<a href="#visibleEdgeColor">visibleEdgeColor</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  134. <div class="description">
  135. <p>The visible edge color.<br/>Default is <code>(1,1,1)</code>.</p>
  136. </div>
  137. </div>
  138. <h2 class="subsection-title">Methods</h2>
  139. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  140. <div class="method">
  141. <div class="description">
  142. <p>Frees the GPU-related resources allocated by this instance. Call this
  143. method whenever the pass is no longer used in your app.</p>
  144. </div>
  145. <dl class="details">
  146. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  147. </dl>
  148. </div>
  149. <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>
  150. <div class="method">
  151. <div class="description">
  152. <p>Performs the Outline pass.</p>
  153. </div>
  154. <table class="params">
  155. <tbody>
  156. <tr>
  157. <td class="name"><code>renderer</code></td>
  158. <td class="description last"><p>The renderer.</p></td>
  159. </tr>
  160. <tr>
  161. <td class="name"><code>writeBuffer</code></td>
  162. <td class="description last"><p>The write buffer. This buffer is intended as the rendering
  163. destination for the pass.</p></td>
  164. </tr>
  165. <tr>
  166. <td class="name"><code>readBuffer</code></td>
  167. <td class="description last"><p>The read buffer. The pass can access the result from the
  168. previous pass from this buffer.</p></td>
  169. </tr>
  170. <tr>
  171. <td class="name"><code>deltaTime</code></td>
  172. <td class="description last"><p>The delta time in seconds.</p></td>
  173. </tr>
  174. <tr>
  175. <td class="name"><code>maskActive</code></td>
  176. <td class="description last"><p>Whether masking is active or not.</p></td>
  177. </tr>
  178. </tbody>
  179. </table>
  180. <dl class="details">
  181. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  182. </dl>
  183. </div>
  184. <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>
  185. <div class="method">
  186. <div class="description">
  187. <p>Sets the size of the pass.</p>
  188. </div>
  189. <table class="params">
  190. <tbody>
  191. <tr>
  192. <td class="name"><code>width</code></td>
  193. <td class="description last"><p>The width to set.</p></td>
  194. </tr>
  195. <tr>
  196. <td class="name"><code>height</code></td>
  197. <td class="description last"><p>The height to set.</p></td>
  198. </tr>
  199. </tbody>
  200. </table>
  201. <dl class="details">
  202. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  203. </dl>
  204. </div>
  205. <h2 class="subsection-title">Source</h2>
  206. <p>
  207. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/OutlinePass.js" target="_blank" rel="noopener" translate="no">examples/jsm/postprocessing/OutlinePass.js</a>
  208. </p>
  209. </article>
  210. </section>
  211. <script src="../scripts/linenumber.js"></script>
  212. <script src="../scripts/page.js"></script>
  213. </body>
  214. </html>
粤ICP备19079148号