LightsNode.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>LightsNode - 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="EventDispatcher.html">EventDispatcher</a> → <a href="Node.html">Node</a> → </p>
  13. <h1 translate="no">LightsNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This node represents the scene's lighting and manages the lighting model's life cycle
  17. for the current build 3D object. It is responsible for computing the total outgoing
  18. light in a given lighting context.</p></div>
  19. </header>
  20. <article>
  21. <div class="container-overview">
  22. <h2>Constructor</h2>
  23. <h3 class="name name-method" id="LightsNode" translate="no">new <a href="#LightsNode">LightsNode</a><span class="signature">()</span> </h3>
  24. <div class="method">
  25. <div class="description">
  26. <p>Constructs a new lights node.</p>
  27. </div>
  28. </div>
  29. </div>
  30. <h2 class="subsection-title">Properties</h2>
  31. <div class="member">
  32. <h3 class="name" id="global" translate="no">.<a href="#global">global</a><span class="type-signature"> : boolean</span> </h3>
  33. <div class="description">
  34. <p><code>LightsNode</code> sets this property to <code>true</code> by default.</p>
  35. <p>Default is <code>true</code>.</p>
  36. </div>
  37. <dl class="details">
  38. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#global">Node#global</a></dt>
  39. </dl>
  40. </div>
  41. <div class="member">
  42. <h3 class="name" id="hasLights" translate="no">.<a href="#hasLights">hasLights</a><span class="type-signature"> : boolean</span> </h3>
  43. <div class="description">
  44. <p>Whether the scene has lights or not.</p>
  45. </div>
  46. </div>
  47. <div class="member">
  48. <h3 class="name" id="outgoingLightNode" translate="no">.<a href="#outgoingLightNode">outgoingLightNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  49. <div class="description">
  50. <p>A node representing the outgoing light.</p>
  51. </div>
  52. </div>
  53. <div class="member">
  54. <h3 class="name" id="totalDiffuseNode" translate="no">.<a href="#totalDiffuseNode">totalDiffuseNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  55. <div class="description">
  56. <p>A node representing the total diffuse light.</p>
  57. </div>
  58. </div>
  59. <div class="member">
  60. <h3 class="name" id="totalSpecularNode" translate="no">.<a href="#totalSpecularNode">totalSpecularNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  61. <div class="description">
  62. <p>A node representing the total specular light.</p>
  63. </div>
  64. </div>
  65. <h2 class="subsection-title">Methods</h2>
  66. <h3 class="name name-method" id="customCacheKey" translate="no">.<a href="#customCacheKey">customCacheKey</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  67. <div class="method">
  68. <div class="description">
  69. <p>Overwrites the default <a href="Node.html#customCacheKey">Node#customCacheKey</a> implementation by including
  70. light data into the cache key.</p>
  71. </div>
  72. <dl class="details">
  73. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#customCacheKey">Node#customCacheKey</a></dt>
  74. </dl>
  75. <dl class="details">
  76. <dt class="tag-returns"><strong>Returns:</strong> The custom cache key.</dt>
  77. </dl>
  78. </div>
  79. <h3 class="name name-method" id="getHash" translate="no">.<a href="#getHash">getHash</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : string</span> </h3>
  80. <div class="method">
  81. <div class="description">
  82. <p>Computes a hash value for identifying the current light nodes setup.</p>
  83. </div>
  84. <table class="params">
  85. <tbody>
  86. <tr>
  87. <td class="name">
  88. <strong>builder</strong>
  89. </td>
  90. <td class="description last">
  91. <p>A reference to the current node builder.</p>
  92. </td>
  93. </tr>
  94. </tbody>
  95. </table>
  96. <dl class="details">
  97. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getHash">Node#getHash</a></dt>
  98. </dl>
  99. <dl class="details">
  100. <dt class="tag-returns"><strong>Returns:</strong> The computed hash.</dt>
  101. </dl>
  102. </div>
  103. <h3 class="name name-method" id="getLights" translate="no">.<a href="#getLights">getLights</a><span class="signature">()</span><span class="type-signature"> : Array.&lt;<a href="Light.html">Light</a>></span> </h3>
  104. <div class="method">
  105. <div class="description">
  106. <p>Returns an array of the scene's lights.</p>
  107. </div>
  108. <dl class="details">
  109. <dt class="tag-returns"><strong>Returns:</strong> The scene's lights.</dt>
  110. </dl>
  111. </div>
  112. <h3 class="name name-method" id="setLights" translate="no">.<a href="#setLights">setLights</a><span class="signature">( lights : <span class="param-type">Array.&lt;<a href="Light.html">Light</a>></span> )</span><span class="type-signature"> : <a href="LightsNode.html">LightsNode</a></span> </h3>
  113. <div class="method">
  114. <div class="description">
  115. <p>Configures this node with an array of lights.</p>
  116. </div>
  117. <table class="params">
  118. <tbody>
  119. <tr>
  120. <td class="name">
  121. <strong>lights</strong>
  122. </td>
  123. <td class="description last">
  124. <p>An array of lights.</p>
  125. </td>
  126. </tr>
  127. </tbody>
  128. </table>
  129. <dl class="details">
  130. <dt class="tag-returns"><strong>Returns:</strong> A reference to this node.</dt>
  131. </dl>
  132. </div>
  133. <h3 class="name name-method" id="setup" translate="no">.<a href="#setup">setup</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  134. <div class="method">
  135. <div class="description">
  136. <p>The implementation makes sure that for each light in the scene
  137. there is a corresponding light node. By building the light nodes
  138. and evaluating the lighting model the outgoing light is computed.</p>
  139. </div>
  140. <table class="params">
  141. <tbody>
  142. <tr>
  143. <td class="name">
  144. <strong>builder</strong>
  145. </td>
  146. <td class="description last">
  147. <p>A reference to the current node builder.</p>
  148. </td>
  149. </tr>
  150. </tbody>
  151. </table>
  152. <dl class="details">
  153. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#setup">Node#setup</a></dt>
  154. </dl>
  155. <dl class="details">
  156. <dt class="tag-returns"><strong>Returns:</strong> A node representing the outgoing light.</dt>
  157. </dl>
  158. </div>
  159. <h3 class="name name-method" id="setupDirectLight" translate="no">.<a href="#setupDirectLight">setupDirectLight</a><span class="signature">( builder : <span class="param-type">Object</span>, lightNode : <span class="param-type">Object</span>, lightData : <span class="param-type">Object</span> )</span> </h3>
  160. <div class="method">
  161. <div class="description">
  162. <p>Sets up a direct light in the lighting model.</p>
  163. </div>
  164. <table class="params">
  165. <tbody>
  166. <tr>
  167. <td class="name">
  168. <strong>builder</strong>
  169. </td>
  170. <td class="description last">
  171. <p>The builder object containing the context and stack.</p>
  172. </td>
  173. </tr>
  174. <tr>
  175. <td class="name">
  176. <strong>lightNode</strong>
  177. </td>
  178. <td class="description last">
  179. <p>The light node.</p>
  180. </td>
  181. </tr>
  182. <tr>
  183. <td class="name">
  184. <strong>lightData</strong>
  185. </td>
  186. <td class="description last">
  187. <p>The light object containing color and direction properties.</p>
  188. </td>
  189. </tr>
  190. </tbody>
  191. </table>
  192. </div>
  193. <h3 class="name name-method" id="setupLights" translate="no">.<a href="#setupLights">setupLights</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span>, lightNodes : <span class="param-type">Array.&lt;<a href="LightingNode.html">LightingNode</a>></span> )</span> </h3>
  194. <div class="method">
  195. <div class="description">
  196. <p>Setups the internal lights by building all respective
  197. light nodes.</p>
  198. </div>
  199. <table class="params">
  200. <tbody>
  201. <tr>
  202. <td class="name">
  203. <strong>builder</strong>
  204. </td>
  205. <td class="description last">
  206. <p>A reference to the current node builder.</p>
  207. </td>
  208. </tr>
  209. <tr>
  210. <td class="name">
  211. <strong>lightNodes</strong>
  212. </td>
  213. <td class="description last">
  214. <p>An array of lighting nodes.</p>
  215. </td>
  216. </tr>
  217. </tbody>
  218. </table>
  219. </div>
  220. <h3 class="name name-method" id="setupLightsNode" translate="no">.<a href="#setupLightsNode">setupLightsNode</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span> </h3>
  221. <div class="method">
  222. <div class="description">
  223. <p>Creates lighting nodes for each scene light. This makes it possible to further
  224. process lights in the node system.</p>
  225. </div>
  226. <table class="params">
  227. <tbody>
  228. <tr>
  229. <td class="name">
  230. <strong>builder</strong>
  231. </td>
  232. <td class="description last">
  233. <p>A reference to the current node builder.</p>
  234. </td>
  235. </tr>
  236. </tbody>
  237. </table>
  238. </div>
  239. <h2 class="subsection-title">Source</h2>
  240. <p>
  241. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/LightsNode.js" translate="no" target="_blank" rel="noopener">src/nodes/lighting/LightsNode.js</a>
  242. </p>
  243. </article>
  244. </section>
  245. <script src="../scripts/linenumber.js"></script>
  246. <script src="../scripts/page.js"></script>
  247. </body>
  248. </html>
粤ICP备19079148号