| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>LightsNode - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Node.html">Node</a> → </p>
- <h1 translate="no">LightsNode</h1>
- <section>
- <header>
- <div class="class-description"><p>This node represents the scene's lighting and manages the lighting model's life cycle
- for the current build 3D object. It is responsible for computing the total outgoing
- light in a given lighting context.</p></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="LightsNode" translate="no">new <a href="#LightsNode">LightsNode</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new lights node.</p>
- </div>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="global" translate="no">.<a href="#global">global</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p><code>LightsNode</code> sets this property to <code>true</code> by default.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#global">Node#global</a></dt>
- </dl>
- </div>
- <div class="member">
- <h3 class="name" id="hasLights" translate="no">.<a href="#hasLights">hasLights</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>Whether the scene has lights or not.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="outgoingLightNode" translate="no">.<a href="#outgoingLightNode">outgoingLightNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<vec3></span> </h3>
- <div class="description">
- <p>A node representing the outgoing light.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="totalDiffuseNode" translate="no">.<a href="#totalDiffuseNode">totalDiffuseNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<vec3></span> </h3>
- <div class="description">
- <p>A node representing the total diffuse light.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="totalSpecularNode" translate="no">.<a href="#totalSpecularNode">totalSpecularNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<vec3></span> </h3>
- <div class="description">
- <p>A node representing the total specular light.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <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>
- <div class="method">
- <div class="description">
- <p>Overwrites the default <a href="Node.html#customCacheKey">Node#customCacheKey</a> implementation by including
- light data into the cache key.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#customCacheKey">Node#customCacheKey</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The custom cache key.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Computes a hash value for identifying the current light nodes setup.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>A reference to the current node builder.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getHash">Node#getHash</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The computed hash.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getLights" translate="no">.<a href="#getLights">getLights</a><span class="signature">()</span><span class="type-signature"> : Array.<<a href="Light.html">Light</a>></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns an array of the scene's lights.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The scene's lights.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setLights" translate="no">.<a href="#setLights">setLights</a><span class="signature">( lights : <span class="param-type">Array.<<a href="Light.html">Light</a>></span> )</span><span class="type-signature"> : <a href="LightsNode.html">LightsNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Configures this node with an array of lights.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>lights</strong>
- </td>
- <td class="description last">
- <p>An array of lights.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this node.</dt>
- </dl>
- </div>
- <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>.<vec3></span> </h3>
- <div class="method">
- <div class="description">
- <p>The implementation makes sure that for each light in the scene
- there is a corresponding light node. By building the light nodes
- and evaluating the lighting model the outgoing light is computed.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>A reference to the current node builder.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#setup">Node#setup</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A node representing the outgoing light.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Sets up a direct light in the lighting model.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The builder object containing the context and stack.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>lightNode</strong>
- </td>
- <td class="description last">
- <p>The light node.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>lightData</strong>
- </td>
- <td class="description last">
- <p>The light object containing color and direction properties.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <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.<<a href="LightingNode.html">LightingNode</a>></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Setups the internal lights by building all respective
- light nodes.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>A reference to the current node builder.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>lightNodes</strong>
- </td>
- <td class="description last">
- <p>An array of lighting nodes.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Creates lighting nodes for each scene light. This makes it possible to further
- process lights in the node system.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>A reference to the current node builder.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <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>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|