OutlinePass.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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" rel="noopener">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"><a href="Vector2.html">Vector2</a></span>, scene : <span class="param-type"><a href="Scene.html">Scene</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, selectedObjects : <span class="param-type">Array.&lt;<a href="Object3D.html">Object3D</a>></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">
  38. <strong>resolution</strong>
  39. </td>
  40. <td class="description last">
  41. <p>The effect's resolution.</p>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="name">
  46. <strong>scene</strong>
  47. </td>
  48. <td class="description last">
  49. <p>The scene to render.</p>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td class="name">
  54. <strong>camera</strong>
  55. </td>
  56. <td class="description last">
  57. <p>The camera.</p>
  58. </td>
  59. </tr>
  60. <tr>
  61. <td class="name">
  62. <strong>selectedObjects</strong>
  63. </td>
  64. <td class="description last">
  65. <p>The selected 3D objects that should receive an outline.</p>
  66. </td>
  67. </tr>
  68. </tbody>
  69. </table>
  70. </div>
  71. </div>
  72. <h2 class="subsection-title">Properties</h2>
  73. <div class="member">
  74. <h3 class="name" id="downSampleRatio" translate="no">.<a href="#downSampleRatio">downSampleRatio</a><span class="type-signature"> : number</span> </h3>
  75. <div class="description">
  76. <p>The downsample ratio. The effect can be rendered in a much
  77. lower resolution than the beauty pass.</p>
  78. <p>Default is <code>2</code>.</p>
  79. </div>
  80. </div>
  81. <div class="member">
  82. <h3 class="name" id="edgeGlow" translate="no">.<a href="#edgeGlow">edgeGlow</a><span class="type-signature"> : number</span> </h3>
  83. <div class="description">
  84. <p>Can be used for an animated glow/pulse effect.</p>
  85. <p>Default is <code>0</code>.</p>
  86. </div>
  87. </div>
  88. <div class="member">
  89. <h3 class="name" id="edgeStrength" translate="no">.<a href="#edgeStrength">edgeStrength</a><span class="type-signature"> : number</span> </h3>
  90. <div class="description">
  91. <p>The edge strength.</p>
  92. <p>Default is <code>3</code>.</p>
  93. </div>
  94. </div>
  95. <div class="member">
  96. <h3 class="name" id="edgeThickness" translate="no">.<a href="#edgeThickness">edgeThickness</a><span class="type-signature"> : number</span> </h3>
  97. <div class="description">
  98. <p>The edge thickness.</p>
  99. <p>Default is <code>1</code>.</p>
  100. </div>
  101. </div>
  102. <div class="member">
  103. <h3 class="name" id="hiddenEdgeColor" translate="no">.<a href="#hiddenEdgeColor">hiddenEdgeColor</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  104. <div class="description">
  105. <p>The hidden edge color.</p>
  106. <p>Default is <code>(0.1,0.04,0.02)</code>.</p>
  107. </div>
  108. </div>
  109. <div class="member">
  110. <h3 class="name" id="patternTexture" translate="no">.<a href="#patternTexture">patternTexture</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  111. <div class="description">
  112. <p>Can be used to highlight selected 3D objects. Requires to set
  113. <a href="OutlinePass.html#usePatternTexture">OutlinePass#usePatternTexture</a> to <code>true</code>.</p>
  114. <p>Default is <code>null</code>.</p>
  115. </div>
  116. </div>
  117. <div class="member">
  118. <h3 class="name" id="pulsePeriod" translate="no">.<a href="#pulsePeriod">pulsePeriod</a><span class="type-signature"> : number</span> </h3>
  119. <div class="description">
  120. <p>The pulse period.</p>
  121. <p>Default is <code>0</code>.</p>
  122. </div>
  123. </div>
  124. <div class="member">
  125. <h3 class="name" id="renderCamera" translate="no">.<a href="#renderCamera">renderCamera</a><span class="type-signature"> : Object</span> </h3>
  126. <div class="description">
  127. <p>The camera.</p>
  128. </div>
  129. </div>
  130. <div class="member">
  131. <h3 class="name" id="renderScene" translate="no">.<a href="#renderScene">renderScene</a><span class="type-signature"> : Object</span> </h3>
  132. <div class="description">
  133. <p>The scene to render.</p>
  134. </div>
  135. </div>
  136. <div class="member">
  137. <h3 class="name" id="resolution" translate="no">.<a href="#resolution">resolution</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  138. <div class="description">
  139. <p>The effect's resolution.</p>
  140. <p>Default is <code>(256,256)</code>.</p>
  141. </div>
  142. </div>
  143. <div class="member">
  144. <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>
  145. <div class="description">
  146. <p>The selected 3D objects that should receive an outline.</p>
  147. </div>
  148. </div>
  149. <div class="member">
  150. <h3 class="name" id="usePatternTexture" translate="no">.<a href="#usePatternTexture">usePatternTexture</a><span class="type-signature"> : boolean</span> </h3>
  151. <div class="description">
  152. <p>Whether to use a pattern texture for to highlight selected
  153. 3D objects or not.</p>
  154. <p>Default is <code>false</code>.</p>
  155. </div>
  156. </div>
  157. <div class="member">
  158. <h3 class="name" id="visibleEdgeColor" translate="no">.<a href="#visibleEdgeColor">visibleEdgeColor</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  159. <div class="description">
  160. <p>The visible edge color.</p>
  161. <p>Default is <code>(1,1,1)</code>.</p>
  162. </div>
  163. </div>
  164. <h2 class="subsection-title">Methods</h2>
  165. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  166. <div class="method">
  167. <div class="description">
  168. <p>Frees the GPU-related resources allocated by this instance. Call this
  169. method whenever the pass is no longer used in your app.</p>
  170. </div>
  171. <dl class="details">
  172. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  173. </dl>
  174. </div>
  175. <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>
  176. <div class="method">
  177. <div class="description">
  178. <p>Performs the Outline pass.</p>
  179. </div>
  180. <table class="params">
  181. <tbody>
  182. <tr>
  183. <td class="name">
  184. <strong>renderer</strong>
  185. </td>
  186. <td class="description last">
  187. <p>The renderer.</p>
  188. </td>
  189. </tr>
  190. <tr>
  191. <td class="name">
  192. <strong>writeBuffer</strong>
  193. </td>
  194. <td class="description last">
  195. <p>The write buffer. This buffer is intended as the rendering
  196. destination for the pass.</p>
  197. </td>
  198. </tr>
  199. <tr>
  200. <td class="name">
  201. <strong>readBuffer</strong>
  202. </td>
  203. <td class="description last">
  204. <p>The read buffer. The pass can access the result from the
  205. previous pass from this buffer.</p>
  206. </td>
  207. </tr>
  208. <tr>
  209. <td class="name">
  210. <strong>deltaTime</strong>
  211. </td>
  212. <td class="description last">
  213. <p>The delta time in seconds.</p>
  214. </td>
  215. </tr>
  216. <tr>
  217. <td class="name">
  218. <strong>maskActive</strong>
  219. </td>
  220. <td class="description last">
  221. <p>Whether masking is active or not.</p>
  222. </td>
  223. </tr>
  224. </tbody>
  225. </table>
  226. <dl class="details">
  227. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  228. </dl>
  229. </div>
  230. <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>
  231. <div class="method">
  232. <div class="description">
  233. <p>Sets the size of the pass.</p>
  234. </div>
  235. <table class="params">
  236. <tbody>
  237. <tr>
  238. <td class="name">
  239. <strong>width</strong>
  240. </td>
  241. <td class="description last">
  242. <p>The width to set.</p>
  243. </td>
  244. </tr>
  245. <tr>
  246. <td class="name">
  247. <strong>height</strong>
  248. </td>
  249. <td class="description last">
  250. <p>The height to set.</p>
  251. </td>
  252. </tr>
  253. </tbody>
  254. </table>
  255. <dl class="details">
  256. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  257. </dl>
  258. </div>
  259. <h2 class="subsection-title">Source</h2>
  260. <p>
  261. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/OutlinePass.js" translate="no" target="_blank" rel="noopener">examples/jsm/postprocessing/OutlinePass.js</a>
  262. </p>
  263. </article>
  264. </section>
  265. <script src="../scripts/linenumber.js"></script>
  266. <script src="../scripts/page.js"></script>
  267. </body>
  268. </html>
粤ICP备19079148号