AnalyticLightNode.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>AnalyticLightNode - 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> → <a href="LightingNode.html">LightingNode</a> → </p>
  13. <h1 translate="no">AnalyticLightNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Base class for analytic light nodes.</p></div>
  17. </header>
  18. <article>
  19. <div class="container-overview">
  20. <h2>Constructor</h2>
  21. <h3 class="name name-method" id="AnalyticLightNode" translate="no">new <a href="#AnalyticLightNode">AnalyticLightNode</a><span class="signature">( light : <span class="param-type"><a href="Light.html">Light</a></span> )</span> </h3>
  22. <div class="method">
  23. <div class="description">
  24. <p>Constructs a new analytic light node.</p>
  25. </div>
  26. <table class="params">
  27. <tbody>
  28. <tr>
  29. <td class="name">
  30. <strong>light</strong>
  31. </td>
  32. <td class="description last">
  33. <p>The light source.</p>
  34. <p>Default is <code>null</code>.</p>
  35. </td>
  36. </tr>
  37. </tbody>
  38. </table>
  39. </div>
  40. </div>
  41. <h2 class="subsection-title">Properties</h2>
  42. <div class="member">
  43. <h3 class="name" id="baseColorNode" translate="no">.<a href="#baseColorNode">baseColorNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  44. <div class="description">
  45. <p>This property is used to retain a reference to the original value of <a href="AnalyticLightNode.html#colorNode">AnalyticLightNode#colorNode</a>.
  46. The final color node is represented by a different node when using shadows.</p>
  47. <p>Default is <code>null</code>.</p>
  48. </div>
  49. </div>
  50. <div class="member">
  51. <h3 class="name" id="color" translate="no">.<a href="#color">color</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  52. <div class="description">
  53. <p>The light's color value.</p>
  54. </div>
  55. </div>
  56. <div class="member">
  57. <h3 class="name" id="colorNode" translate="no">.<a href="#colorNode">colorNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  58. <div class="description">
  59. <p>The light's color node. Points to <code>colorNode</code> of the light source, if set. Otherwise
  60. it creates a uniform node based on <a href="AnalyticLightNode.html#color">AnalyticLightNode#color</a>.</p>
  61. </div>
  62. </div>
  63. <div class="member">
  64. <h3 class="name" id="isAnalyticLightNode" translate="no">.<a href="#isAnalyticLightNode">isAnalyticLightNode</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  65. <div class="description">
  66. <p>This flag can be used for type testing.</p>
  67. <p>Default is <code>true</code>.</p>
  68. </div>
  69. </div>
  70. <div class="member">
  71. <h3 class="name" id="light" translate="no">.<a href="#light">light</a><span class="type-signature"> : <a href="Light.html">Light</a></span> </h3>
  72. <div class="description">
  73. <p>The light source.</p>
  74. <p>Default is <code>null</code>.</p>
  75. </div>
  76. </div>
  77. <div class="member">
  78. <h3 class="name" id="shadowColorNode" translate="no">.<a href="#shadowColorNode">shadowColorNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  79. <div class="description">
  80. <p>Represents the light's shadow color.</p>
  81. <p>Default is <code>null</code>.</p>
  82. </div>
  83. </div>
  84. <div class="member">
  85. <h3 class="name" id="shadowNode" translate="no">.<a href="#shadowNode">shadowNode</a><span class="type-signature"> : <a href="ShadowNode.html">ShadowNode</a></span> </h3>
  86. <div class="description">
  87. <p>Represents the light's shadow.</p>
  88. <p>Default is <code>null</code>.</p>
  89. </div>
  90. </div>
  91. <div class="member">
  92. <h3 class="name" id="updateType" translate="no">.<a href="#updateType">updateType</a><span class="type-signature"> : string</span> </h3>
  93. <div class="description">
  94. <p>Overwritten since analytic light nodes are updated
  95. once per frame.</p>
  96. <p>Default is <code>'frame'</code>.</p>
  97. </div>
  98. <dl class="details">
  99. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="LightingNode.html#updateType">LightingNode#updateType</a></dt>
  100. </dl>
  101. </div>
  102. <h2 class="subsection-title">Methods</h2>
  103. <h3 class="name name-method" id="getLightVector" translate="no">.<a href="#getLightVector">getLightVector</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>
  104. <div class="method">
  105. <div class="description">
  106. <p>Returns a node representing a direction vector which points from the current
  107. position in view space to the light's position in view space.</p>
  108. </div>
  109. <table class="params">
  110. <tbody>
  111. <tr>
  112. <td class="name">
  113. <strong>builder</strong>
  114. </td>
  115. <td class="description last">
  116. <p>The builder object used for setting up the light.</p>
  117. </td>
  118. </tr>
  119. </tbody>
  120. </table>
  121. <dl class="details">
  122. <dt class="tag-returns"><strong>Returns:</strong> The light vector node.</dt>
  123. </dl>
  124. </div>
  125. <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> </h3>
  126. <div class="method">
  127. <div class="description">
  128. <p>Unlike most other nodes, lighting nodes do not return a output node in <a href="Node.html#setup">Node#setup</a>.
  129. The main purpose of lighting nodes is to configure the current <a href="LightingModel.html">LightingModel</a> and/or
  130. invocate the respective interface methods.</p>
  131. </div>
  132. <table class="params">
  133. <tbody>
  134. <tr>
  135. <td class="name">
  136. <strong>builder</strong>
  137. </td>
  138. <td class="description last">
  139. <p>The current node builder.</p>
  140. </td>
  141. </tr>
  142. </tbody>
  143. </table>
  144. <dl class="details">
  145. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="LightingNode.html#setup">LightingNode#setup</a></dt>
  146. </dl>
  147. </div>
  148. <h3 class="name name-method" id="setupDirect" translate="no">.<a href="#setupDirect">setupDirect</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : Object | undefined</span> <span class="type-signature">(abstract) </span></h3>
  149. <div class="method">
  150. <div class="description">
  151. <p>Sets up the direct lighting for the analytic light node.</p>
  152. </div>
  153. <table class="params">
  154. <tbody>
  155. <tr>
  156. <td class="name">
  157. <strong>builder</strong>
  158. </td>
  159. <td class="description last">
  160. <p>The builder object used for setting up the light.</p>
  161. </td>
  162. </tr>
  163. </tbody>
  164. </table>
  165. <dl class="details">
  166. <dt class="tag-returns"><strong>Returns:</strong> The direct light data (color and direction).</dt>
  167. </dl>
  168. </div>
  169. <h3 class="name name-method" id="setupDirectRectArea" translate="no">.<a href="#setupDirectRectArea">setupDirectRectArea</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : Object | undefined</span> <span class="type-signature">(abstract) </span></h3>
  170. <div class="method">
  171. <div class="description">
  172. <p>Sets up the direct rect area lighting for the analytic light node.</p>
  173. </div>
  174. <table class="params">
  175. <tbody>
  176. <tr>
  177. <td class="name">
  178. <strong>builder</strong>
  179. </td>
  180. <td class="description last">
  181. <p>The builder object used for setting up the light.</p>
  182. </td>
  183. </tr>
  184. </tbody>
  185. </table>
  186. <dl class="details">
  187. <dt class="tag-returns"><strong>Returns:</strong> The direct rect area light data.</dt>
  188. </dl>
  189. </div>
  190. <h3 class="name name-method" id="setupShadow" translate="no">.<a href="#setupShadow">setupShadow</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span> </h3>
  191. <div class="method">
  192. <div class="description">
  193. <p>Setups the shadow for this light. This method is only executed if the light
  194. cast shadows and the current build object receives shadows. It incorporates
  195. shadows into the lighting computation.</p>
  196. </div>
  197. <table class="params">
  198. <tbody>
  199. <tr>
  200. <td class="name">
  201. <strong>builder</strong>
  202. </td>
  203. <td class="description last">
  204. <p>The current node builder.</p>
  205. </td>
  206. </tr>
  207. </tbody>
  208. </table>
  209. </div>
  210. <h3 class="name name-method" id="setupShadowNode" translate="no">.<a href="#setupShadowNode">setupShadowNode</a><span class="signature">()</span><span class="type-signature"> : <a href="ShadowNode.html">ShadowNode</a></span> </h3>
  211. <div class="method">
  212. <div class="description">
  213. <p>Setups the shadow node for this light. The method exists so concrete light classes
  214. can setup different types of shadow nodes.</p>
  215. </div>
  216. <dl class="details">
  217. <dt class="tag-returns"><strong>Returns:</strong> The created shadow node.</dt>
  218. </dl>
  219. </div>
  220. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">( frame : <span class="param-type"><a href="NodeFrame.html">NodeFrame</a></span> )</span> </h3>
  221. <div class="method">
  222. <div class="description">
  223. <p>The update method is used to update light uniforms per frame.
  224. Potentially overwritten in concrete light nodes to update light
  225. specific uniforms.</p>
  226. </div>
  227. <table class="params">
  228. <tbody>
  229. <tr>
  230. <td class="name">
  231. <strong>frame</strong>
  232. </td>
  233. <td class="description last">
  234. <p>A reference to the current node frame.</p>
  235. </td>
  236. </tr>
  237. </tbody>
  238. </table>
  239. <dl class="details">
  240. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="LightingNode.html#update">LightingNode#update</a></dt>
  241. </dl>
  242. </div>
  243. <h2 class="subsection-title">Source</h2>
  244. <p>
  245. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/AnalyticLightNode.js" translate="no" target="_blank" rel="noopener">src/nodes/lighting/AnalyticLightNode.js</a>
  246. </p>
  247. </article>
  248. </section>
  249. <script src="../scripts/linenumber.js"></script>
  250. <script src="../scripts/page.js"></script>
  251. </body>
  252. </html>
粤ICP备19079148号