Layers.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Layers - 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. <h1 translate="no">Layers</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>A layers object assigns an 3D object to 1 or more of 32
  16. layers numbered <code>0</code> to <code>31</code> - internally the layers are stored as a
  17. bit mask], and by default all 3D objects are a member of layer <code>0</code>.</p>
  18. <p>This can be used to control visibility - an object must share a layer with
  19. a camera to be visible when that camera's view is
  20. rendered.</p>
  21. <p>All classes that inherit from <a href="Object3D.html">Object3D</a> have an <code>layers</code> property which
  22. is an instance of this class.</p></div>
  23. </header>
  24. <article>
  25. <div class="container-overview">
  26. <h2>Constructor</h2>
  27. <h3 class="name name-method" id="Layers" translate="no">new <a href="#Layers">Layers</a><span class="signature">()</span> </h3>
  28. <div class="method">
  29. <div class="description">
  30. <p>Constructs a new layers instance, with membership
  31. initially set to layer <code>0</code>.</p>
  32. </div>
  33. </div>
  34. </div>
  35. <h2 class="subsection-title">Properties</h2>
  36. <div class="member">
  37. <h3 class="name" id="mask" translate="no">.<a href="#mask">mask</a><span class="type-signature"> : number</span> </h3>
  38. <div class="description">
  39. <p>A bit mask storing which of the 32 layers this layers object is currently
  40. a member of.</p>
  41. </div>
  42. </div>
  43. <h2 class="subsection-title">Methods</h2>
  44. <h3 class="name name-method" id="disable" translate="no">.<a href="#disable">disable</a><span class="signature">( layer : <span class="param-type">number</span> )</span> </h3>
  45. <div class="method">
  46. <div class="description">
  47. <p>Removes membership of the given layer.</p>
  48. </div>
  49. <table class="params">
  50. <tbody>
  51. <tr>
  52. <td class="name">
  53. <strong>layer</strong>
  54. </td>
  55. <td class="description last">
  56. <p>The layer to enable.</p>
  57. </td>
  58. </tr>
  59. </tbody>
  60. </table>
  61. </div>
  62. <h3 class="name name-method" id="disableAll" translate="no">.<a href="#disableAll">disableAll</a><span class="signature">()</span> </h3>
  63. <div class="method">
  64. <div class="description">
  65. <p>Removes the membership from all layers.</p>
  66. </div>
  67. </div>
  68. <h3 class="name name-method" id="enable" translate="no">.<a href="#enable">enable</a><span class="signature">( layer : <span class="param-type">number</span> )</span> </h3>
  69. <div class="method">
  70. <div class="description">
  71. <p>Adds membership of the given layer.</p>
  72. </div>
  73. <table class="params">
  74. <tbody>
  75. <tr>
  76. <td class="name">
  77. <strong>layer</strong>
  78. </td>
  79. <td class="description last">
  80. <p>The layer to enable.</p>
  81. </td>
  82. </tr>
  83. </tbody>
  84. </table>
  85. </div>
  86. <h3 class="name name-method" id="enableAll" translate="no">.<a href="#enableAll">enableAll</a><span class="signature">()</span> </h3>
  87. <div class="method">
  88. <div class="description">
  89. <p>Adds membership to all layers.</p>
  90. </div>
  91. </div>
  92. <h3 class="name name-method" id="isEnabled" translate="no">.<a href="#isEnabled">isEnabled</a><span class="signature">( layer : <span class="param-type">number</span> )</span><span class="type-signature"> : boolean</span> </h3>
  93. <div class="method">
  94. <div class="description">
  95. <p>Returns <code>true</code> if the given layer is enabled.</p>
  96. </div>
  97. <table class="params">
  98. <tbody>
  99. <tr>
  100. <td class="name">
  101. <strong>layer</strong>
  102. </td>
  103. <td class="description last">
  104. <p>The layer to test.</p>
  105. </td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. <dl class="details">
  110. <dt class="tag-returns"><strong>Returns:</strong> Whether the given layer is enabled or not.</dt>
  111. </dl>
  112. </div>
  113. <h3 class="name name-method" id="set" translate="no">.<a href="#set">set</a><span class="signature">( layer : <span class="param-type">number</span> )</span> </h3>
  114. <div class="method">
  115. <div class="description">
  116. <p>Sets membership to the given layer, and remove membership all other layers.</p>
  117. </div>
  118. <table class="params">
  119. <tbody>
  120. <tr>
  121. <td class="name">
  122. <strong>layer</strong>
  123. </td>
  124. <td class="description last">
  125. <p>The layer to set.</p>
  126. </td>
  127. </tr>
  128. </tbody>
  129. </table>
  130. </div>
  131. <h3 class="name name-method" id="test" translate="no">.<a href="#test">test</a><span class="signature">( layers : <span class="param-type"><a href="Layers.html">Layers</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  132. <div class="method">
  133. <div class="description">
  134. <p>Returns <code>true</code> if this and the given layers object have at least one
  135. layer in common.</p>
  136. </div>
  137. <table class="params">
  138. <tbody>
  139. <tr>
  140. <td class="name">
  141. <strong>layers</strong>
  142. </td>
  143. <td class="description last">
  144. <p>The layers to test.</p>
  145. </td>
  146. </tr>
  147. </tbody>
  148. </table>
  149. <dl class="details">
  150. <dt class="tag-returns"><strong>Returns:</strong> Whether this and the given layers object have at least one layer in common or not.</dt>
  151. </dl>
  152. </div>
  153. <h3 class="name name-method" id="toggle" translate="no">.<a href="#toggle">toggle</a><span class="signature">( layer : <span class="param-type">number</span> )</span> </h3>
  154. <div class="method">
  155. <div class="description">
  156. <p>Toggles the membership of the given layer.</p>
  157. </div>
  158. <table class="params">
  159. <tbody>
  160. <tr>
  161. <td class="name">
  162. <strong>layer</strong>
  163. </td>
  164. <td class="description last">
  165. <p>The layer to toggle.</p>
  166. </td>
  167. </tr>
  168. </tbody>
  169. </table>
  170. </div>
  171. <h2 class="subsection-title">Source</h2>
  172. <p>
  173. <a href="https://github.com/mrdoob/three.js/blob/master/src/core/Layers.js" translate="no" target="_blank" rel="noopener">src/core/Layers.js</a>
  174. </p>
  175. </article>
  176. </section>
  177. <script src="../scripts/linenumber.js"></script>
  178. <script src="../scripts/page.js"></script>
  179. </body>
  180. </html>
粤ICP备19079148号