ContextNode.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ContextNode - 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">ContextNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This node can be used as a context management component for another node.
  17. <a href="NodeBuilder.html">NodeBuilder</a> performs its node building process in a specific context and
  18. this node allows the modify the context. A typical use case is to overwrite <code>getUV()</code> e.g.:</p></div>
  19. <h2>Code Example</h2>
  20. <div translate="no"><pre><code class="language-js">node.context( { getUV: () => customCoord } );
  21. \// or
  22. material.contextNode = context( { getUV: () => customCoord } );
  23. \// or
  24. renderer.contextNode = context( { getUV: () => customCoord } );
  25. \// or
  26. scenePass.contextNode = context( { getUV: () => customCoord } );
  27. </code></pre></div>
  28. </header>
  29. <article>
  30. <div class="container-overview">
  31. <h2>Constructor</h2>
  32. <h3 class="name name-method" id="ContextNode" translate="no">new <a href="#ContextNode">ContextNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, value : <span class="param-type">Object</span> )</span> </h3>
  33. <div class="method">
  34. <div class="description">
  35. <p>Constructs a new context node.</p>
  36. </div>
  37. <table class="params">
  38. <tbody>
  39. <tr>
  40. <td class="name">
  41. <strong>node</strong>
  42. </td>
  43. <td class="description last">
  44. <p>The node whose context should be modified.</p>
  45. <p>Default is <code>null</code>.</p>
  46. </td>
  47. </tr>
  48. <tr>
  49. <td class="name">
  50. <strong>value</strong>
  51. </td>
  52. <td class="description last">
  53. <p>The modified context data.</p>
  54. <p>Default is <code>{}</code>.</p>
  55. </td>
  56. </tr>
  57. </tbody>
  58. </table>
  59. </div>
  60. </div>
  61. <h2 class="subsection-title">Properties</h2>
  62. <div class="member">
  63. <h3 class="name" id="isContextNode" translate="no">.<a href="#isContextNode">isContextNode</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  64. <div class="description">
  65. <p>This flag can be used for type testing.</p>
  66. <p>Default is <code>true</code>.</p>
  67. </div>
  68. </div>
  69. <div class="member">
  70. <h3 class="name" id="node" translate="no">.<a href="#node">node</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  71. <div class="description">
  72. <p>The node whose context should be modified.</p>
  73. </div>
  74. </div>
  75. <div class="member">
  76. <h3 class="name" id="value" translate="no">.<a href="#value">value</a><span class="type-signature"> : Object</span> </h3>
  77. <div class="description">
  78. <p>The modified context data.</p>
  79. <p>Default is <code>{}</code>.</p>
  80. </div>
  81. </div>
  82. <h2 class="subsection-title">Methods</h2>
  83. <h3 class="name name-method" id="getFlowContextData" translate="no">.<a href="#getFlowContextData">getFlowContextData</a><span class="signature">()</span><span class="type-signature"> : Object</span> </h3>
  84. <div class="method">
  85. <div class="description">
  86. <p>Gathers the context data from all parent context nodes.</p>
  87. </div>
  88. <dl class="details">
  89. <dt class="tag-returns"><strong>Returns:</strong> The gathered context data.</dt>
  90. </dl>
  91. </div>
  92. <h3 class="name name-method" id="getMemberType" translate="no">.<a href="#getMemberType">getMemberType</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span>, name : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  93. <div class="method">
  94. <div class="description">
  95. <p>This method is overwritten to ensure it returns the member type of <a href="ContextNode.html#node">ContextNode#node</a>.</p>
  96. </div>
  97. <table class="params">
  98. <tbody>
  99. <tr>
  100. <td class="name">
  101. <strong>builder</strong>
  102. </td>
  103. <td class="description last">
  104. <p>The current node builder.</p>
  105. </td>
  106. </tr>
  107. <tr>
  108. <td class="name">
  109. <strong>name</strong>
  110. </td>
  111. <td class="description last">
  112. <p>The member name.</p>
  113. </td>
  114. </tr>
  115. </tbody>
  116. </table>
  117. <dl class="details">
  118. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getMemberType">Node#getMemberType</a></dt>
  119. </dl>
  120. <dl class="details">
  121. <dt class="tag-returns"><strong>Returns:</strong> The member type.</dt>
  122. </dl>
  123. </div>
  124. <h3 class="name name-method" id="getNodeType" translate="no">.<a href="#getNodeType">getNodeType</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : string</span> </h3>
  125. <div class="method">
  126. <div class="description">
  127. <p>This method is overwritten to ensure it returns the type of <a href="ContextNode.html#node">ContextNode#node</a>.</p>
  128. </div>
  129. <table class="params">
  130. <tbody>
  131. <tr>
  132. <td class="name">
  133. <strong>builder</strong>
  134. </td>
  135. <td class="description last">
  136. <p>The current node builder.</p>
  137. </td>
  138. </tr>
  139. </tbody>
  140. </table>
  141. <dl class="details">
  142. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getNodeType">Node#getNodeType</a></dt>
  143. </dl>
  144. <dl class="details">
  145. <dt class="tag-returns"><strong>Returns:</strong> The node type.</dt>
  146. </dl>
  147. </div>
  148. <h3 class="name name-method" id="getScope" translate="no">.<a href="#getScope">getScope</a><span class="signature">()</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  149. <div class="method">
  150. <div class="description">
  151. <p>This method is overwritten to ensure it returns the reference to <a href="ContextNode.html#node">ContextNode#node</a>.</p>
  152. </div>
  153. <dl class="details">
  154. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getScope">Node#getScope</a></dt>
  155. </dl>
  156. <dl class="details">
  157. <dt class="tag-returns"><strong>Returns:</strong> A reference to <a href="ContextNode.html#node">ContextNode#node</a>.</dt>
  158. </dl>
  159. </div>
  160. <h2 class="subsection-title">Source</h2>
  161. <p>
  162. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/core/ContextNode.js" translate="no" target="_blank" rel="noopener">src/nodes/core/ContextNode.js</a>
  163. </p>
  164. </article>
  165. </section>
  166. <script src="../scripts/linenumber.js"></script>
  167. <script src="../scripts/page.js"></script>
  168. </body>
  169. </html>
粤ICP备19079148号