ContextNode.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. </code></pre></div>
  22. </header>
  23. <article>
  24. <div class="container-overview">
  25. <h2>Constructor</h2>
  26. <h3 class="name name-method" id="ContextNode" translate="no">new <a href="#ContextNode">ContextNode</a><span class="signature">( node : <span class="param-type">Node</span>, value : <span class="param-type">Object</span> )</span> </h3>
  27. <div class="method">
  28. <div class="description">
  29. <p>Constructs a new context node.</p>
  30. </div>
  31. <table class="params">
  32. <tbody>
  33. <tr>
  34. <td class="name"><code>node</code></td>
  35. <td class="description last"><p>The node whose context should be modified.</p></td>
  36. </tr>
  37. <tr>
  38. <td class="name"><code>value</code></td>
  39. <td class="description last"><p>The modified context data.<br/>Default is <code>{}</code>.</p></td>
  40. </tr>
  41. </tbody>
  42. </table>
  43. </div>
  44. </div>
  45. <h2 class="subsection-title">Properties</h2>
  46. <div class="member">
  47. <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>
  48. <div class="description">
  49. <p>This flag can be used for type testing.<br/>Default is <code>true</code>.</p>
  50. </div>
  51. </div>
  52. <div class="member">
  53. <h3 class="name" id="node" translate="no">.<a href="#node">node</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  54. <div class="description">
  55. <p>The node whose context should be modified.</p>
  56. </div>
  57. </div>
  58. <div class="member">
  59. <h3 class="name" id="value" translate="no">.<a href="#value">value</a><span class="type-signature"> : Object</span> </h3>
  60. <div class="description">
  61. <p>The modified context data.<br/>Default is <code>{}</code>.</p>
  62. </div>
  63. </div>
  64. <h2 class="subsection-title">Methods</h2>
  65. <h3 class="name name-method" id="getMemberType" translate="no">.<a href="#getMemberType">getMemberType</a><span class="signature">( builder : <span class="param-type">NodeBuilder</span>, name : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  66. <div class="method">
  67. <div class="description">
  68. <p>This method is overwritten to ensure it returns the member type of <a href="ContextNode.html#node">ContextNode#node</a>.</p>
  69. </div>
  70. <table class="params">
  71. <tbody>
  72. <tr>
  73. <td class="name"><code>builder</code></td>
  74. <td class="description last"><p>The current node builder.</p></td>
  75. </tr>
  76. <tr>
  77. <td class="name"><code>name</code></td>
  78. <td class="description last"><p>The member name.</p></td>
  79. </tr>
  80. </tbody>
  81. </table>
  82. <dl class="details">
  83. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getMemberType">Node#getMemberType</a></dt>
  84. </dl>
  85. <dl class="details">
  86. <dt class="tag-returns"><strong>Returns:</strong> The member type.</dt>
  87. </dl>
  88. </div>
  89. <h3 class="name name-method" id="getNodeType" translate="no">.<a href="#getNodeType">getNodeType</a><span class="signature">( builder : <span class="param-type">NodeBuilder</span> )</span><span class="type-signature"> : string</span> </h3>
  90. <div class="method">
  91. <div class="description">
  92. <p>This method is overwritten to ensure it returns the type of <a href="ContextNode.html#node">ContextNode#node</a>.</p>
  93. </div>
  94. <table class="params">
  95. <tbody>
  96. <tr>
  97. <td class="name"><code>builder</code></td>
  98. <td class="description last"><p>The current node builder.</p></td>
  99. </tr>
  100. </tbody>
  101. </table>
  102. <dl class="details">
  103. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getNodeType">Node#getNodeType</a></dt>
  104. </dl>
  105. <dl class="details">
  106. <dt class="tag-returns"><strong>Returns:</strong> The node type.</dt>
  107. </dl>
  108. </div>
  109. <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>
  110. <div class="method">
  111. <div class="description">
  112. <p>This method is overwritten to ensure it returns the reference to <a href="ContextNode.html#node">ContextNode#node</a>.</p>
  113. </div>
  114. <dl class="details">
  115. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getScope">Node#getScope</a></dt>
  116. </dl>
  117. <dl class="details">
  118. <dt class="tag-returns"><strong>Returns:</strong> A reference to <a href="ContextNode.html#node">ContextNode#node</a>.</dt>
  119. </dl>
  120. </div>
  121. <h2 class="subsection-title">Source</h2>
  122. <p>
  123. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/core/ContextNode.js" target="_blank" rel="noopener" translate="no">src/nodes/core/ContextNode.js</a>
  124. </p>
  125. </article>
  126. </section>
  127. <script src="../scripts/linenumber.js"></script>
  128. <script src="../scripts/page.js"></script>
  129. </body>
  130. </html>
粤ICP备19079148号