OverrideContextNode.html 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>OverrideContextNode - 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="ContextNode.html">ContextNode</a> → </p>
  13. <h1 translate="no">OverrideContextNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A specialized context node designed to override specific target nodes within a
  17. node sub-graph or flow. This allows replacing specific inputs (e.g., normal
  18. and position vectors) dynamically during compilation for a specific flow node,
  19. without having to reconstruct or duplicate the source nodes.</p></div>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">// Method chaining example:
  22. node.overrideNode( positionLocal, () => positionLocal.add( vec3( 1, 0, 0 ) ) );
  23. // Context assignment example:
  24. material.contextNode = overrideNode( positionLocal, () => positionLocal.add( vec3( 1, 0, 0 ) ) );
  25. </code></pre></div>
  26. </header>
  27. <article>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <h3 class="name name-method" id="OverrideContextNode" translate="no">new <a href="#OverrideContextNode">OverrideContextNode</a><span class="signature">( overrideNodes : <span class="param-type">Map.&lt;<a href="Node.html">Node</a>, function()></span>, flowNode : <span class="param-type"><a href="Node.html">Node</a> | null</span> )</span> </h3>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a new override context node.</p>
  34. </div>
  35. <table class="params">
  36. <tbody>
  37. <tr>
  38. <td class="name">
  39. <strong translate="no">overrideNodes</strong>
  40. </td>
  41. <td class="description last">
  42. <p>A map mapping target nodes to their respective override callback functions.</p>
  43. </td>
  44. </tr>
  45. <tr>
  46. <td class="name">
  47. <strong translate="no">flowNode</strong>
  48. </td>
  49. <td class="description last">
  50. <p>The node whose context should be modified.</p>
  51. <p>Default is <code>null</code>.</p>
  52. </td>
  53. </tr>
  54. </tbody>
  55. </table>
  56. </div>
  57. </div>
  58. <h2 class="subsection-title">Properties</h2>
  59. <div class="member">
  60. <h3 class="name" id="isOverrideContextNode" translate="no">.<a href="#isOverrideContextNode">isOverrideContextNode</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  61. <div class="description">
  62. <p>This flag can be used for type testing.</p>
  63. <p>Default is <code>true</code>.</p>
  64. </div>
  65. </div>
  66. <div class="member">
  67. <h3 class="name" id=".type" translate="no">.<a href="#.type">type</a><span class="type-signature"> : string</span> <span class="type-signature">(readonly) </span></h3>
  68. <div class="description">
  69. <p>Returns the type of the node.</p>
  70. </div>
  71. </div>
  72. <h2 class="subsection-title">Methods</h2>
  73. <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>
  74. <div class="method">
  75. <div class="description">
  76. <p>Gathers the context data from all parent context nodes by traversing the hierarchy,
  77. merging the <code>overrideNodes</code> maps from all encountered <code>OverrideContextNode</code> instances.</p>
  78. </div>
  79. <dl class="details">
  80. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="ContextNode.html#getFlowContextData">ContextNode#getFlowContextData</a></dt>
  81. </dl>
  82. <dl class="details">
  83. <dt class="tag-returns"><strong>Returns:</strong> The gathered context data, containing the merged <code>overrideNodes</code> map.</dt>
  84. </dl>
  85. </div>
  86. <h2 class="subsection-title">Source</h2>
  87. <p>
  88. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/core/OverrideContextNode.js" translate="no" target="_blank" rel="noopener">src/nodes/core/OverrideContextNode.js</a>
  89. </p>
  90. </article>
  91. </section>
  92. <script src="../scripts/linenumber.js"></script>
  93. <script src="../scripts/page.js"></script>
  94. </body>
  95. </html>
粤ICP备19079148号