Layers.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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"><code>layer</code></td>
  53. <td class="description last"><p>The layer to enable.</p></td>
  54. </tr>
  55. </tbody>
  56. </table>
  57. </div>
  58. <h3 class="name name-method" id="disableAll" translate="no">.<a href="#disableAll">disableAll</a><span class="signature">()</span> </h3>
  59. <div class="method">
  60. <div class="description">
  61. <p>Removes the membership from all layers.</p>
  62. </div>
  63. </div>
  64. <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>
  65. <div class="method">
  66. <div class="description">
  67. <p>Adds membership of the given layer.</p>
  68. </div>
  69. <table class="params">
  70. <tbody>
  71. <tr>
  72. <td class="name"><code>layer</code></td>
  73. <td class="description last"><p>The layer to enable.</p></td>
  74. </tr>
  75. </tbody>
  76. </table>
  77. </div>
  78. <h3 class="name name-method" id="enableAll" translate="no">.<a href="#enableAll">enableAll</a><span class="signature">()</span> </h3>
  79. <div class="method">
  80. <div class="description">
  81. <p>Adds membership to all layers.</p>
  82. </div>
  83. </div>
  84. <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>
  85. <div class="method">
  86. <div class="description">
  87. <p>Returns <code>true</code> if the given layer is enabled.</p>
  88. </div>
  89. <table class="params">
  90. <tbody>
  91. <tr>
  92. <td class="name"><code>layer</code></td>
  93. <td class="description last"><p>The layer to test.</p></td>
  94. </tr>
  95. </tbody>
  96. </table>
  97. <dl class="details">
  98. <dt class="tag-returns"><strong>Returns:</strong> Whether the given layer is enabled or not.</dt>
  99. </dl>
  100. </div>
  101. <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>
  102. <div class="method">
  103. <div class="description">
  104. <p>Sets membership to the given layer, and remove membership all other layers.</p>
  105. </div>
  106. <table class="params">
  107. <tbody>
  108. <tr>
  109. <td class="name"><code>layer</code></td>
  110. <td class="description last"><p>The layer to set.</p></td>
  111. </tr>
  112. </tbody>
  113. </table>
  114. </div>
  115. <h3 class="name name-method" id="test" translate="no">.<a href="#test">test</a><span class="signature">( layers : <span class="param-type">Layers</span> )</span><span class="type-signature"> : boolean</span> </h3>
  116. <div class="method">
  117. <div class="description">
  118. <p>Returns <code>true</code> if this and the given layers object have at least one
  119. layer in common.</p>
  120. </div>
  121. <table class="params">
  122. <tbody>
  123. <tr>
  124. <td class="name"><code>layers</code></td>
  125. <td class="description last"><p>The layers to test.</p></td>
  126. </tr>
  127. </tbody>
  128. </table>
  129. <dl class="details">
  130. <dt class="tag-returns"><strong>Returns:</strong> Whether this and the given layers object have at least one layer in common or not.</dt>
  131. </dl>
  132. </div>
  133. <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>
  134. <div class="method">
  135. <div class="description">
  136. <p>Toggles the membership of the given layer.</p>
  137. </div>
  138. <table class="params">
  139. <tbody>
  140. <tr>
  141. <td class="name"><code>layer</code></td>
  142. <td class="description last"><p>The layer to toggle.</p></td>
  143. </tr>
  144. </tbody>
  145. </table>
  146. </div>
  147. <h2 class="subsection-title">Source</h2>
  148. <p>
  149. <a href="https://github.com/mrdoob/three.js/blob/master/src/core/Layers.js" target="_blank" rel="noopener" translate="no">src/core/Layers.js</a>
  150. </p>
  151. </article>
  152. </section>
  153. <script src="../scripts/linenumber.js"></script>
  154. <script src="../scripts/page.js"></script>
  155. </body>
  156. </html>
粤ICP备19079148号