VarNode.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>VarNode - 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">VarNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Class for representing shader variables as nodes. Variables are created from
  17. existing nodes like the following:</p></div>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const depth = sampleDepth( uvNode ).toVar( 'depth' );
  20. </code></pre></div>
  21. </header>
  22. <article>
  23. <div class="container-overview">
  24. <h2>Constructor</h2>
  25. <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>
  26. <div class="method">
  27. <div class="description">
  28. <p>Constructs a new variable node.</p>
  29. </div>
  30. <table class="params">
  31. <tbody>
  32. <tr>
  33. <td class="name">
  34. <strong>node</strong>
  35. </td>
  36. <td class="description last">
  37. <p>The node for which a variable should be created.</p>
  38. </td>
  39. </tr>
  40. <tr>
  41. <td class="name">
  42. <strong>name</strong>
  43. </td>
  44. <td class="description last">
  45. <p>The name of the variable in the shader.</p>
  46. <p>Default is <code>null</code>.</p>
  47. </td>
  48. </tr>
  49. <tr>
  50. <td class="name">
  51. <strong>readOnly</strong>
  52. </td>
  53. <td class="description last">
  54. <p>The read-only flag.</p>
  55. <p>Default is <code>false</code>.</p>
  56. </td>
  57. </tr>
  58. </tbody>
  59. </table>
  60. </div>
  61. </div>
  62. <h2 class="subsection-title">Properties</h2>
  63. <div class="member">
  64. <h3 class="name" id="global" translate="no">.<a href="#global">global</a><span class="type-signature"> : boolean</span> </h3>
  65. <div class="description">
  66. <p><code>VarNode</code> sets this property to <code>true</code> by default.</p>
  67. <p>Default is <code>true</code>.</p>
  68. </div>
  69. <dl class="details">
  70. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#global">Node#global</a></dt>
  71. </dl>
  72. </div>
  73. <div class="member">
  74. <h3 class="name" id="intent" translate="no">.<a href="#intent">intent</a><span class="type-signature"> : boolean</span> </h3>
  75. <div class="description">
  76. <p>This flag is used to indicate that this node is used for intent.</p>
  77. <p>Default is <code>false</code>.</p>
  78. </div>
  79. </div>
  80. <div class="member">
  81. <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>
  82. <div class="description">
  83. <p>This flag can be used for type testing.</p>
  84. <p>Default is <code>true</code>.</p>
  85. </div>
  86. </div>
  87. <div class="member">
  88. <h3 class="name" id="name" translate="no">.<a href="#name">name</a><span class="type-signature"> : string</span> </h3>
  89. <div class="description">
  90. <p>The name of the variable in the shader. If no name is defined,
  91. the node system auto-generates one.</p>
  92. <p>Default is <code>null</code>.</p>
  93. </div>
  94. <dl class="details">
  95. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#name">Node#name</a></dt>
  96. </dl>
  97. </div>
  98. <div class="member">
  99. <h3 class="name" id="node" translate="no">.<a href="#node">node</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  100. <div class="description">
  101. <p>The node for which a variable should be created.</p>
  102. </div>
  103. </div>
  104. <div class="member">
  105. <h3 class="name" id="parents" translate="no">.<a href="#parents">parents</a><span class="type-signature"> : boolean</span> </h3>
  106. <div class="description">
  107. <p>Add this flag to the node system to indicate that this node require parents.</p>
  108. <p>Default is <code>true</code>.</p>
  109. </div>
  110. <dl class="details">
  111. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#parents">Node#parents</a></dt>
  112. </dl>
  113. </div>
  114. <div class="member">
  115. <h3 class="name" id="readOnly" translate="no">.<a href="#readOnly">readOnly</a><span class="type-signature"> : boolean</span> </h3>
  116. <div class="description">
  117. <p>The read-only flag.</p>
  118. <p>Default is <code>false</code>.</p>
  119. </div>
  120. </div>
  121. <h2 class="subsection-title">Methods</h2>
  122. <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>
  123. <div class="method">
  124. <div class="description">
  125. <p>Returns the intent flag of this node.</p>
  126. </div>
  127. <dl class="details">
  128. <dt class="tag-returns"><strong>Returns:</strong> The intent flag.</dt>
  129. </dl>
  130. </div>
  131. <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>
  132. <div class="method">
  133. <div class="description">
  134. <p>Sets the intent flag for this node.</p>
  135. <p>This flag is used to indicate that this node is used for intent
  136. and should not be built directly. Instead, it is used to indicate that
  137. the node should be treated as a variable intent.</p>
  138. <p>It's useful for assigning variables without needing creating a new variable node.</p>
  139. </div>
  140. <table class="params">
  141. <tbody>
  142. <tr>
  143. <td class="name">
  144. <strong>value</strong>
  145. </td>
  146. <td class="description last">
  147. <p>The value to set for the intent flag.</p>
  148. </td>
  149. </tr>
  150. </tbody>
  151. </table>
  152. <dl class="details">
  153. <dt class="tag-returns"><strong>Returns:</strong> This node.</dt>
  154. </dl>
  155. </div>
  156. <h2 class="subsection-title">Source</h2>
  157. <p>
  158. <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>
  159. </p>
  160. </article>
  161. </section>
  162. <script src="../scripts/linenumber.js"></script>
  163. <script src="../scripts/page.js"></script>
  164. </body>
  165. </html>
粤ICP备19079148号