| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>VarNode - 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">VarNode</h1>
- <section>
- <header>
- <div class="class-description"><p>Class for representing shader variables as nodes. Variables are created from
- existing nodes like the following:</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const depth = sampleDepth( uvNode ).toVar( 'depth' );
- </code></pre></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="VarNode" translate="no">new <a href="#VarNode">VarNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, name : <span class="param-type">string</span>, readOnly : <span class="param-type">boolean</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new variable node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>node</strong>
- </td>
- <td class="description last">
- <p>The node for which a variable should be created.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>The name of the variable in the shader.</p>
- <p>Default is <code>null</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>readOnly</strong>
- </td>
- <td class="description last">
- <p>The read-only flag.</p>
- <p>Default is <code>false</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </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>VarNode</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="intent" translate="no">.<a href="#intent">intent</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>This flag is used to indicate that this node is used for intent.</p>
- <p>Default is <code>false</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="isVarNode" translate="no">.<a href="#isVarNode">isVarNode</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>This flag can be used for type testing.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="name" translate="no">.<a href="#name">name</a><span class="type-signature"> : string</span> </h3>
- <div class="description">
- <p>The name of the variable in the shader. If no name is defined,
- the node system auto-generates one.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#name">Node#name</a></dt>
- </dl>
- </div>
- <div class="member">
- <h3 class="name" id="node" translate="no">.<a href="#node">node</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
- <div class="description">
- <p>The node for which a variable should be created.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="parents" translate="no">.<a href="#parents">parents</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>Add this flag to the node system to indicate that this node require parents.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#parents">Node#parents</a></dt>
- </dl>
- </div>
- <div class="member">
- <h3 class="name" id="readOnly" translate="no">.<a href="#readOnly">readOnly</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>The read-only flag.</p>
- <p>Default is <code>false</code>.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="getIntent" translate="no">.<a href="#getIntent">getIntent</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the intent flag of this node.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The intent flag.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setIntent" translate="no">.<a href="#setIntent">setIntent</a><span class="signature">( value : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="VarNode.html">VarNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the intent flag for this node.</p>
- <p>This flag is used to indicate that this node is used for intent
- and should not be built directly. Instead, it is used to indicate that
- the node should be treated as a variable intent.</p>
- <p>It's useful for assigning variables without needing creating a new variable node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The value to set for the intent flag.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> This node.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/core/VarNode.js" translate="no" target="_blank" rel="noopener">src/nodes/core/VarNode.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|